Supabase backup
This commit is contained in:
committed by
github-actions[bot]
parent
76dcf24991
commit
0a1f61f587
+2437
-2157
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
SET default_transaction_read_only = off;
|
||||||
|
|
||||||
|
SET client_encoding = 'UTF8';
|
||||||
|
SET standard_conforming_strings = on;
|
||||||
|
|
||||||
|
ALTER ROLE "anon" SET "statement_timeout" TO '3s';
|
||||||
|
|
||||||
|
ALTER ROLE "authenticated" SET "statement_timeout" TO '8s';
|
||||||
|
|
||||||
|
ALTER ROLE "authenticator" SET "statement_timeout" TO '8s';
|
||||||
|
|
||||||
|
RESET ALL;
|
||||||
+227
-218
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SET statement_timeout = 0;
|
SET statement_timeout = 0;
|
||||||
SET lock_timeout = 0;
|
SET lock_timeout = 0;
|
||||||
SET idle_in_transaction_session_timeout = 0;
|
SET idle_in_transaction_session_timeout = 0;
|
||||||
@@ -272,10 +273,10 @@ ALTER TYPE "public"."tipo_origen" OWNER TO "postgres";
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."append_conversacion_asignatura"("p_id" "uuid", "p_append" "jsonb") RETURNS "void"
|
CREATE OR REPLACE FUNCTION "public"."append_conversacion_asignatura"("p_id" "uuid", "p_append" "jsonb") RETURNS "void"
|
||||||
LANGUAGE "sql"
|
LANGUAGE "sql"
|
||||||
AS $$
|
AS $$
|
||||||
update conversaciones_asignatura
|
update conversaciones_asignatura
|
||||||
set conversacion_json = coalesce(conversacion_json, '[]'::jsonb) || p_append
|
set conversacion_json = coalesce(conversacion_json, '[]'::jsonb) || p_append
|
||||||
where id = p_id;
|
where id = p_id;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
@@ -284,10 +285,10 @@ ALTER FUNCTION "public"."append_conversacion_asignatura"("p_id" "uuid", "p_appen
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."append_conversacion_plan"("p_id" "uuid", "p_append" "jsonb") RETURNS "void"
|
CREATE OR REPLACE FUNCTION "public"."append_conversacion_plan"("p_id" "uuid", "p_append" "jsonb") RETURNS "void"
|
||||||
LANGUAGE "sql"
|
LANGUAGE "sql"
|
||||||
AS $$
|
AS $$
|
||||||
update conversaciones_plan
|
update conversaciones_plan
|
||||||
set conversacion_json = coalesce(conversacion_json, '[]'::jsonb) || p_append
|
set conversacion_json = coalesce(conversacion_json, '[]'::jsonb) || p_append
|
||||||
where id = p_id;
|
where id = p_id;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
@@ -296,158 +297,160 @@ ALTER FUNCTION "public"."append_conversacion_plan"("p_id" "uuid", "p_append" "js
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."fn_log_cambios_planes_estudio"() RETURNS "trigger"
|
CREATE OR REPLACE FUNCTION "public"."fn_log_cambios_planes_estudio"() RETURNS "trigger"
|
||||||
LANGUAGE "plpgsql"
|
LANGUAGE "plpgsql"
|
||||||
AS $$declare
|
AS $$declare
|
||||||
k text;
|
k text;
|
||||||
old_val jsonb;
|
old_val jsonb;
|
||||||
new_val jsonb;
|
new_val jsonb;
|
||||||
|
|
||||||
v_response_id text;
|
v_response_id text;
|
||||||
begin
|
begin
|
||||||
v_response_id := nullif(new.meta_origen->>'response_id','');
|
v_response_id := nullif(new.meta_origen->>'response_id','');
|
||||||
|
|
||||||
-- INSERT -> CREACION
|
-- INSERT -> CREACION
|
||||||
if tg_op = 'INSERT' then
|
if tg_op = 'INSERT' then
|
||||||
insert into public.cambios_plan (
|
insert into public.cambios_plan (
|
||||||
plan_estudio_id,
|
plan_estudio_id,
|
||||||
cambiado_por,
|
cambiado_por,
|
||||||
tipo,
|
tipo,
|
||||||
campo,
|
campo,
|
||||||
valor_anterior,
|
valor_anterior,
|
||||||
valor_nuevo,
|
valor_nuevo,
|
||||||
response_id
|
response_id
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
new.id,
|
new.id,
|
||||||
new.creado_por,
|
new.creado_por,
|
||||||
'CREACION'::public.tipo_cambio,
|
'CREACION'::public.tipo_cambio,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
to_jsonb(new),
|
to_jsonb(new),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- DELETE (opcional): si no lo quieres, bórralo
|
-- DELETE (opcional): si no lo quieres, bórralo
|
||||||
if tg_op = 'DELETE' then
|
if tg_op = 'DELETE' then
|
||||||
insert into public.cambios_plan (
|
insert into public.cambios_plan (
|
||||||
plan_estudio_id,
|
plan_estudio_id,
|
||||||
cambiado_por,
|
cambiado_por,
|
||||||
tipo,
|
tipo,
|
||||||
campo,
|
campo,
|
||||||
valor_anterior,
|
valor_anterior,
|
||||||
valor_nuevo,
|
valor_nuevo,
|
||||||
response_id
|
response_id
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
old.id,
|
old.id,
|
||||||
old.actualizado_por,
|
old.actualizado_por,
|
||||||
'OTRO'::public.tipo_cambio,
|
'OTRO'::public.tipo_cambio,
|
||||||
'DELETE',
|
'DELETE',
|
||||||
to_jsonb(old),
|
to_jsonb(old),
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- UPDATE ----------------------------------------------------------
|
-- UPDATE ----------------------------------------------------------
|
||||||
-- 1) Transición de estado
|
-- 1) Transición de estado
|
||||||
if (new.estado_actual_id is distinct from old.estado_actual_id) then
|
if (new.estado_actual_id is distinct from old.estado_actual_id) then
|
||||||
insert into public.cambios_plan (
|
insert into public.cambios_plan (
|
||||||
plan_estudio_id, cambiado_por, tipo, campo, valor_anterior, valor_nuevo, response_id
|
plan_estudio_id, cambiado_por, tipo, campo, valor_anterior, valor_nuevo, response_id
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
new.id,
|
new.id,
|
||||||
new.actualizado_por,
|
new.actualizado_por,
|
||||||
'TRANSICION_ESTADO'::public.tipo_cambio,
|
'TRANSICION_ESTADO'::public.tipo_cambio,
|
||||||
'estado_actual_id',
|
'estado_actual_id',
|
||||||
to_jsonb(old.estado_actual_id),
|
to_jsonb(old.estado_actual_id),
|
||||||
to_jsonb(new.estado_actual_id),
|
to_jsonb(new.estado_actual_id),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- 2) Cambios en JSONB "datos" (diff top-level por llave)
|
-- 2) Cambios en JSONB "datos" (diff top-level por llave)
|
||||||
if (new.datos is distinct from old.datos) then
|
if (new.datos is distinct from old.datos) then
|
||||||
for k in
|
for k in
|
||||||
select distinct key
|
select distinct key
|
||||||
from (
|
from (
|
||||||
select jsonb_object_keys(coalesce(old.datos, '{}'::jsonb)) as key
|
select jsonb_object_keys(coalesce(old.datos, '{}'::jsonb)) as key
|
||||||
union all
|
union all
|
||||||
select jsonb_object_keys(coalesce(new.datos, '{}'::jsonb)) as key
|
select jsonb_object_keys(coalesce(new.datos, '{}'::jsonb)) as key
|
||||||
) t
|
) t
|
||||||
loop
|
loop
|
||||||
old_val := coalesce(old.datos, '{}'::jsonb) -> k;
|
old_val := coalesce(old.datos, '{}'::jsonb) -> k;
|
||||||
new_val := coalesce(new.datos, '{}'::jsonb) -> k;
|
new_val := coalesce(new.datos, '{}'::jsonb) -> k;
|
||||||
|
|
||||||
if (old_val is distinct from new_val) then
|
if (old_val is distinct from new_val) then
|
||||||
insert into public.cambios_plan (
|
insert into public.cambios_plan (
|
||||||
plan_estudio_id, cambiado_por, tipo, campo, valor_anterior, valor_nuevo, response_id
|
plan_estudio_id, cambiado_por, tipo, campo, valor_anterior, valor_nuevo, response_id
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
new.id,
|
new.id,
|
||||||
new.actualizado_por,
|
new.actualizado_por,
|
||||||
'ACTUALIZACION_CAMPO'::public.tipo_cambio,
|
'ACTUALIZACION_CAMPO'::public.tipo_cambio,
|
||||||
k,
|
k,
|
||||||
old_val,
|
old_val,
|
||||||
new_val,
|
new_val,
|
||||||
v_response_id
|
v_response_id
|
||||||
);
|
);
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- 3) Cambios en columnas "normales" (uno por columna)
|
-- 3) Cambios en columnas "normales" (uno por columna)
|
||||||
if (new.nombre is distinct from old.nombre) then
|
if (new.nombre is distinct from old.nombre) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'nombre', to_jsonb(old.nombre), to_jsonb(new.nombre), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'nombre', to_jsonb(old.nombre), to_jsonb(new.nombre), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.nivel is distinct from old.nivel) then
|
if (new.nivel is distinct from old.nivel) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'nivel', to_jsonb(old.nivel), to_jsonb(new.nivel), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'nivel', to_jsonb(old.nivel), to_jsonb(new.nivel), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.tipo_ciclo is distinct from old.tipo_ciclo) then
|
if (new.tipo_ciclo is distinct from old.tipo_ciclo) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'tipo_ciclo', to_jsonb(old.tipo_ciclo), to_jsonb(new.tipo_ciclo), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'tipo_ciclo', to_jsonb(old.tipo_ciclo), to_jsonb(new.tipo_ciclo), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.numero_ciclos is distinct from old.numero_ciclos) then
|
if (new.numero_ciclos is distinct from old.numero_ciclos) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'numero_ciclos', to_jsonb(old.numero_ciclos), to_jsonb(new.numero_ciclos), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'numero_ciclos', to_jsonb(old.numero_ciclos), to_jsonb(new.numero_ciclos), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.activo is distinct from old.activo) then
|
if (new.activo is distinct from old.activo) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'activo', to_jsonb(old.activo), to_jsonb(new.activo), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'activo', to_jsonb(old.activo), to_jsonb(new.activo), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.carrera_id is distinct from old.carrera_id) then
|
if (new.carrera_id is distinct from old.carrera_id) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'carrera_id', to_jsonb(old.carrera_id), to_jsonb(new.carrera_id), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'carrera_id', to_jsonb(old.carrera_id), to_jsonb(new.carrera_id), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.estructura_id is distinct from old.estructura_id) then
|
if (new.estructura_id is distinct from old.estructura_id) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'estructura_id', to_jsonb(old.estructura_id), to_jsonb(new.estructura_id), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'estructura_id', to_jsonb(old.estructura_id), to_jsonb(new.estructura_id), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if (new.tipo_origen is distinct from old.tipo_origen) then
|
if (new.tipo_origen is distinct from old.tipo_origen) then
|
||||||
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
insert into public.cambios_plan values (gen_random_uuid(), new.id, new.actualizado_por, now(),
|
||||||
'ACTUALIZACION'::public.tipo_cambio, 'tipo_origen', to_jsonb(old.tipo_origen), to_jsonb(new.tipo_origen), null);
|
'ACTUALIZACION'::public.tipo_cambio, 'tipo_origen', to_jsonb(old.tipo_origen), to_jsonb(new.tipo_origen), null);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- 🔥 consumirlo para que NO se guarde en planes_estudio
|
|
||||||
if v_response_id is not null then
|
|
||||||
new.meta_origen := new.meta_origen - 'response_id';
|
-- 🔥 consumirlo para que NO se guarde en planes_estudio
|
||||||
end if;
|
if v_response_id is not null then
|
||||||
|
new.meta_origen := new.meta_origen - 'response_id';
|
||||||
return new;
|
end if;
|
||||||
|
|
||||||
|
return new;
|
||||||
end;$$;
|
end;$$;
|
||||||
|
|
||||||
|
|
||||||
@@ -456,11 +459,11 @@ ALTER FUNCTION "public"."fn_log_cambios_planes_estudio"() OWNER TO "postgres";
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_actualizado_en"() RETURNS "trigger"
|
CREATE OR REPLACE FUNCTION "public"."set_actualizado_en"() RETURNS "trigger"
|
||||||
LANGUAGE "plpgsql"
|
LANGUAGE "plpgsql"
|
||||||
AS $$
|
AS $$
|
||||||
begin
|
begin
|
||||||
new.actualizado_en = now();
|
new.actualizado_en = now();
|
||||||
return new;
|
return new;
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
@@ -469,8 +472,8 @@ ALTER FUNCTION "public"."set_actualizado_en"() OWNER TO "postgres";
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."unaccent_immutable"("text") RETURNS "text"
|
CREATE OR REPLACE FUNCTION "public"."unaccent_immutable"("text") RETURNS "text"
|
||||||
LANGUAGE "sql" IMMUTABLE STRICT PARALLEL SAFE
|
LANGUAGE "sql" IMMUTABLE STRICT PARALLEL SAFE
|
||||||
AS $_$
|
AS $_$
|
||||||
SELECT public.unaccent('public.unaccent', $1);
|
SELECT public.unaccent('public.unaccent', $1);
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
@@ -479,33 +482,33 @@ ALTER FUNCTION "public"."unaccent_immutable"("text") OWNER TO "postgres";
|
|||||||
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."validar_numero_ciclo_asignatura"() RETURNS "trigger"
|
CREATE OR REPLACE FUNCTION "public"."validar_numero_ciclo_asignatura"() RETURNS "trigger"
|
||||||
LANGUAGE "plpgsql"
|
LANGUAGE "plpgsql"
|
||||||
AS $$
|
AS $$
|
||||||
declare
|
declare
|
||||||
v_numero_ciclos int;
|
v_numero_ciclos int;
|
||||||
begin
|
begin
|
||||||
if new.numero_ciclo is null then
|
if new.numero_ciclo is null then
|
||||||
return new;
|
return new;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
select pe.numero_ciclos into v_numero_ciclos
|
select pe.numero_ciclos into v_numero_ciclos
|
||||||
from planes_estudio pe
|
from planes_estudio pe
|
||||||
where pe.id = new.plan_estudio_id;
|
where pe.id = new.plan_estudio_id;
|
||||||
|
|
||||||
if v_numero_ciclos is null then
|
if v_numero_ciclos is null then
|
||||||
raise exception 'plan_estudio_id inválido %, plan no encontrado', new.plan_estudio_id;
|
raise exception 'plan_estudio_id inválido %, plan no encontrado', new.plan_estudio_id;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if new.numero_ciclo < 1 then
|
if new.numero_ciclo < 1 then
|
||||||
raise exception 'numero_ciclo debe ser >= 1 (recibido %)', new.numero_ciclo;
|
raise exception 'numero_ciclo debe ser >= 1 (recibido %)', new.numero_ciclo;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if new.numero_ciclo > v_numero_ciclos then
|
if new.numero_ciclo > v_numero_ciclos then
|
||||||
raise exception 'numero_ciclo % excede planes_estudio.numero_ciclos % para plan_estudio_id %',
|
raise exception 'numero_ciclo % excede planes_estudio.numero_ciclos % para plan_estudio_id %',
|
||||||
new.numero_ciclo, v_numero_ciclos, new.plan_estudio_id;
|
new.numero_ciclo, v_numero_ciclos, new.plan_estudio_id;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
@@ -570,9 +573,9 @@ CREATE TABLE IF NOT EXISTS "public"."asignaturas" (
|
|||||||
"actualizado_por" "uuid",
|
"actualizado_por" "uuid",
|
||||||
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
||||||
"actualizado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
"actualizado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
||||||
"asignatura_hash" "text" GENERATED ALWAYS AS ("encode"(SUBSTRING("extensions"."digest"(("id")::"text", 'sha512'::"text") FROM 1 FOR 12), 'hex'::"text")) STORED,
|
|
||||||
"horas_academicas" integer,
|
"horas_academicas" integer,
|
||||||
"horas_independientes" integer,
|
"horas_independientes" integer,
|
||||||
|
"asignatura_hash" "text" GENERATED ALWAYS AS ("encode"(SUBSTRING("extensions"."digest"(("id")::"text", 'sha512'::"text") FROM 1 FOR 12), 'hex'::"text")) STORED,
|
||||||
"estado" "public"."estado_asignatura" DEFAULT 'borrador'::"public"."estado_asignatura" NOT NULL,
|
"estado" "public"."estado_asignatura" DEFAULT 'borrador'::"public"."estado_asignatura" NOT NULL,
|
||||||
"criterios_de_evaluacion" "jsonb" DEFAULT '[]'::"jsonb" NOT NULL,
|
"criterios_de_evaluacion" "jsonb" DEFAULT '[]'::"jsonb" NOT NULL,
|
||||||
CONSTRAINT "asignaturas_ciclo_chk" CHECK ((("numero_ciclo" IS NULL) OR ("numero_ciclo" > 0))),
|
CONSTRAINT "asignaturas_ciclo_chk" CHECK ((("numero_ciclo" IS NULL) OR ("numero_ciclo" > 0))),
|
||||||
@@ -591,11 +594,11 @@ CREATE TABLE IF NOT EXISTS "public"."bibliografia_asignatura" (
|
|||||||
"asignatura_id" "uuid" NOT NULL,
|
"asignatura_id" "uuid" NOT NULL,
|
||||||
"tipo" "public"."tipo_bibliografia" NOT NULL,
|
"tipo" "public"."tipo_bibliografia" NOT NULL,
|
||||||
"cita" "text" NOT NULL,
|
"cita" "text" NOT NULL,
|
||||||
"tipo_fuente" "public"."tipo_fuente_bibliografia" DEFAULT 'MANUAL'::"public"."tipo_fuente_bibliografia" NOT NULL,
|
|
||||||
"biblioteca_item_id" "text",
|
|
||||||
"creado_por" "uuid",
|
"creado_por" "uuid",
|
||||||
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
||||||
"actualizado_en" timestamp with time zone DEFAULT "now"() NOT NULL
|
"actualizado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
||||||
|
"referencia_biblioteca" "text",
|
||||||
|
"referencia_en_linea" "text"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -635,10 +638,6 @@ CREATE TABLE IF NOT EXISTS "public"."cambios_plan" (
|
|||||||
ALTER TABLE "public"."cambios_plan" OWNER TO "postgres";
|
ALTER TABLE "public"."cambios_plan" OWNER TO "postgres";
|
||||||
|
|
||||||
|
|
||||||
COMMENT ON COLUMN "public"."cambios_plan"."response_id" IS 'El ID de respuesta de OpenAI';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "public"."carreras" (
|
CREATE TABLE IF NOT EXISTS "public"."carreras" (
|
||||||
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
|
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
|
||||||
"facultad_id" "uuid" NOT NULL,
|
"facultad_id" "uuid" NOT NULL,
|
||||||
@@ -664,7 +663,8 @@ CREATE TABLE IF NOT EXISTS "public"."conversaciones_asignatura" (
|
|||||||
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
"creado_en" timestamp with time zone DEFAULT "now"() NOT NULL,
|
||||||
"archivado_por" "uuid",
|
"archivado_por" "uuid",
|
||||||
"archivado_en" timestamp with time zone,
|
"archivado_en" timestamp with time zone,
|
||||||
"intento_archivado" integer DEFAULT 0 NOT NULL
|
"intento_archivado" integer DEFAULT 0 NOT NULL,
|
||||||
|
"nombre" "text" DEFAULT ('Chat '::"text" || CURRENT_DATE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -845,10 +845,10 @@ CREATE OR REPLACE VIEW "public"."plantilla_asignatura" AS
|
|||||||
JOIN "public"."estructuras_asignatura" "struct" ON (("asignaturas"."estructura_id" = "struct"."id")));
|
JOIN "public"."estructuras_asignatura" "struct" ON (("asignaturas"."estructura_id" = "struct"."id")));
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE "public"."plantilla_asignatura" OWNER TO "postgres";
|
ALTER VIEW "public"."plantilla_asignatura" OWNER TO "postgres";
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW "public"."plantilla_plan" WITH ("security_invoker"='on') AS
|
CREATE OR REPLACE VIEW "public"."plantilla_plan" AS
|
||||||
SELECT "plan"."id" AS "plan_estudio_id",
|
SELECT "plan"."id" AS "plan_estudio_id",
|
||||||
"struct"."id" AS "estructura_id",
|
"struct"."id" AS "estructura_id",
|
||||||
"struct"."template_id"
|
"struct"."template_id"
|
||||||
@@ -856,7 +856,7 @@ CREATE OR REPLACE VIEW "public"."plantilla_plan" WITH ("security_invoker"='on')
|
|||||||
JOIN "public"."estructuras_plan" "struct" ON (("plan"."estructura_id" = "struct"."id")));
|
JOIN "public"."estructuras_plan" "struct" ON (("plan"."estructura_id" = "struct"."id")));
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE "public"."plantilla_plan" OWNER TO "postgres";
|
ALTER VIEW "public"."plantilla_plan" OWNER TO "postgres";
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "public"."responsables_asignatura" (
|
CREATE TABLE IF NOT EXISTS "public"."responsables_asignatura" (
|
||||||
@@ -1429,10 +1429,18 @@ ALTER PUBLICATION "supabase_realtime" OWNER TO "postgres";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."asignatura_mensajes_ia";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."asignaturas";
|
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."asignaturas";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."plan_mensajes_ia";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."planes_estudio";
|
ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."planes_estudio";
|
||||||
|
|
||||||
|
|
||||||
@@ -1937,30 +1945,31 @@ GRANT ALL ON TABLE "public"."vector_stores" TO "service_role";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";
|
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user