diff --git a/docs/arquitectura-comercio-2026-09-12.md b/docs/arquitectura-comercio-2026-09-12.md index 0266ab4..1b33eb9 100644 --- a/docs/arquitectura-comercio-2026-09-12.md +++ b/docs/arquitectura-comercio-2026-09-12.md @@ -71,13 +71,17 @@ entregar varios archivos mediante relaciones específicas cuando se publiquen. `plan_suscripcion` define código, nombre, nivel, precio y periodicidad. Sus capacidades operativas —publicidad, calidad de escucha, cupo y calidad de -descargas, y acceso a versiones— son columnas estructuradas; `prestaciones` +descargas, acceso a versiones, contenido del taller y descarga de sus +materiales— son columnas estructuradas y dependen del ámbito del plan; +`prestaciones` queda para ventajas editoriales adicionales y no para tomar decisiones de acceso. También conserva la referencia de precio externa. `suscripcion` registra el periodo contratado por cada cuenta y apunta opcionalmente al plan. La relación es opcional para conservar las concesiones manuales históricas. -Los niveles públicos iniciales son Follower, Friend y VIP. La contratación y la +Los planes musicales públicos iniciales son Seguidor, Amigo y Buen amigo. El Taller +de letras dispone de una suscripción anual independiente, con acceso completo y +descarga de materiales. La contratación y la aplicación efectiva de publicidad, calidades y cupos se conectarán sobre estas capacidades, sin comparar nombres ni textos comerciales. diff --git a/drizzle/0033_superb_silverclaw.sql b/drizzle/0033_superb_silverclaw.sql new file mode 100644 index 0000000..3c18363 --- /dev/null +++ b/drizzle/0033_superb_silverclaw.sql @@ -0,0 +1,77 @@ +ALTER TABLE "plan_suscripcion" DROP CONSTRAINT "plan_suscripcion_calidad_escucha_conocida";--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ALTER COLUMN "calidad_escucha" DROP NOT NULL;--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD COLUMN "ambito" text DEFAULT 'musica' NOT NULL;--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD COLUMN "acceso_contenido_taller" boolean DEFAULT false NOT NULL;--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD COLUMN "descarga_material_taller" boolean DEFAULT false NOT NULL;--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD CONSTRAINT "plan_suscripcion_ambito_conocido" CHECK ("plan_suscripcion"."ambito" in ('musica', 'taller_letras'));--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD CONSTRAINT "plan_suscripcion_capacidades_segun_ambito" CHECK (( + "plan_suscripcion"."ambito" = 'musica' + and "plan_suscripcion"."calidad_escucha" is not null + and not "plan_suscripcion"."acceso_contenido_taller" + and not "plan_suscripcion"."descarga_material_taller" + ) or ( + "plan_suscripcion"."ambito" = 'taller_letras' + and "plan_suscripcion"."calidad_escucha" is null + and not "plan_suscripcion"."incluye_publicidad" + and "plan_suscripcion"."descargas_incluidas" = 0 + and "plan_suscripcion"."calidad_descarga" is null + and not "plan_suscripcion"."acceso_versiones" + ));--> statement-breakpoint +ALTER TABLE "plan_suscripcion" ADD CONSTRAINT "plan_suscripcion_calidad_escucha_conocida" CHECK ("plan_suscripcion"."calidad_escucha" is null or "plan_suscripcion"."calidad_escucha" in ('media', 'alta')); +--> statement-breakpoint +UPDATE "plan_suscripcion" +SET + "descripcion" = CASE "codigo" + WHEN 'follower' THEN 'Para descubrir el catálogo a tu ritmo, crear tus listas y apoyar el proyecto desde el primer día.' + WHEN 'friend' THEN 'Una escucha sin interrupciones para quienes quieren llevarse sus canciones favoritas.' + WHEN 'vip' THEN 'La experiencia musical más completa: más descargas y acceso a las distintas versiones de cada canción.' + END, + "prestaciones" = '["Favoritos y listas de reproducción"]'::jsonb, + "actualizado_en" = now() +WHERE "codigo" IN ('follower', 'friend', 'vip'); +--> statement-breakpoint +INSERT INTO "plan_suscripcion" ( + "id", "codigo", "nombre", "descripcion", "nivel", "precio_centimos", "moneda", + "periodicidad", "intervalos", "ambito", "incluye_publicidad", "calidad_escucha", + "descargas_incluidas", "calidad_descarga", "acceso_versiones", + "acceso_contenido_taller", "descarga_material_taller", "prestaciones", "estado" +) VALUES ( + '08af3913-6788-47b9-ad50-ce2371d0f05d', + 'taller-letras', + 'Taller de letras', + 'Un año para profundizar en la escritura de canciones, avanzar a tu ritmo y conservar todos los materiales.', + 1, + 990, + 'eur', + 'ano', + 1, + 'taller_letras', + false, + null, + 0, + null, + false, + true, + true, + '["Aprendizaje a tu ritmo"]'::jsonb, + 'disponible' +) +ON CONFLICT ("codigo") DO UPDATE SET + "nombre" = EXCLUDED."nombre", + "descripcion" = EXCLUDED."descripcion", + "nivel" = EXCLUDED."nivel", + "precio_centimos" = EXCLUDED."precio_centimos", + "moneda" = EXCLUDED."moneda", + "periodicidad" = EXCLUDED."periodicidad", + "intervalos" = EXCLUDED."intervalos", + "ambito" = EXCLUDED."ambito", + "incluye_publicidad" = EXCLUDED."incluye_publicidad", + "calidad_escucha" = EXCLUDED."calidad_escucha", + "descargas_incluidas" = EXCLUDED."descargas_incluidas", + "calidad_descarga" = EXCLUDED."calidad_descarga", + "acceso_versiones" = EXCLUDED."acceso_versiones", + "acceso_contenido_taller" = EXCLUDED."acceso_contenido_taller", + "descarga_material_taller" = EXCLUDED."descarga_material_taller", + "prestaciones" = EXCLUDED."prestaciones", + "estado" = EXCLUDED."estado", + "actualizado_en" = now(); diff --git a/drizzle/0034_planes_en_espanol.sql b/drizzle/0034_planes_en_espanol.sql new file mode 100644 index 0000000..272b82c --- /dev/null +++ b/drizzle/0034_planes_en_espanol.sql @@ -0,0 +1,9 @@ +UPDATE "plan_suscripcion" +SET + "nombre" = CASE "codigo" + WHEN 'follower' THEN 'Seguidor' + WHEN 'friend' THEN 'Amigo' + WHEN 'vip' THEN 'Buen amigo' + END, + "actualizado_en" = now() +WHERE "codigo" IN ('follower', 'friend', 'vip'); diff --git a/drizzle/meta/0033_snapshot.json b/drizzle/meta/0033_snapshot.json new file mode 100644 index 0000000..01745b9 --- /dev/null +++ b/drizzle/meta/0033_snapshot.json @@ -0,0 +1,8350 @@ +{ + "id": "52430917-b431-4a34-99f8-5da72c557bf4", + "prevId": "5b93e3d1-66c7-4ced-acbf-e3bd68088694", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.medio": { + "name": "medio", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "clase": { + "name": "clase", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "clave": { + "name": "clave", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "publico": { + "name": "publico", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "mime": { + "name": "mime", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bytes": { + "name": "bytes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "duracion_s": { + "name": "duracion_s", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ancho": { + "name": "ancho", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "alto": { + "name": "alto", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "medio_clase": { + "name": "medio_clase", + "columns": [ + { + "expression": "clase", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "medio_sha": { + "name": "medio_sha", + "columns": [ + { + "expression": "sha256", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "medio_clave_unique": { + "name": "medio_clave_unique", + "nullsNotDistinct": false, + "columns": [ + "clave" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pais": { + "name": "pais", + "schema": "", + "columns": { + "codigo": { + "name": "codigo", + "type": "char(2)", + "primaryKey": true, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gentilicio": { + "name": "gentilicio", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "region": { + "name": "region", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.persona": { + "name": "persona", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_legal": { + "name": "nombre_legal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ipi": { + "name": "ipi", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nacimiento": { + "name": "nacimiento", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "defuncion": { + "name": "defuncion", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "retrato_id": { + "name": "retrato_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "semblanza": { + "name": "semblanza", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "persona_nombre": { + "name": "persona_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "persona_pais": { + "name": "persona_pais", + "columns": [ + { + "expression": "pais_codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "persona_pais_codigo_pais_codigo_fk": { + "name": "persona_pais_codigo_pais_codigo_fk", + "tableFrom": "persona", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "persona_retrato_id_medio_id_fk": { + "name": "persona_retrato_id_medio_id_fk", + "tableFrom": "persona", + "tableTo": "medio", + "columnsFrom": [ + "retrato_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "persona_slug_unique": { + "name": "persona_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artista": { + "name": "artista", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ART-' || lpad(nextval('artista_codigo_seq')::text, 6, '0')" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persona'" + }, + "es_virtual": { + "name": "es_virtual", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_visual": { + "name": "nombre_visual", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'texto'" + }, + "descripcion_corta": { + "name": "descripcion_corta", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "biografia": { + "name": "biografia", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_id": { + "name": "logotipo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_claro_id": { + "name": "logotipo_claro_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_oscuro_id": { + "name": "logotipo_oscuro_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "lugar_origen": { + "name": "lugar_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inicio": { + "name": "inicio", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "fin": { + "name": "fin", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sitio_web": { + "name": "sitio_web", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "artista_codigo_unico": { + "name": "artista_codigo_unico", + "columns": [ + { + "expression": "codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "artista_slug_unico": { + "name": "artista_slug_unico", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "artista_nombre": { + "name": "artista_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "artista_estado": { + "name": "artista_estado", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "artista_imagen_id_medio_id_fk": { + "name": "artista_imagen_id_medio_id_fk", + "tableFrom": "artista", + "tableTo": "medio", + "columnsFrom": [ + "imagen_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "artista_logotipo_id_medio_id_fk": { + "name": "artista_logotipo_id_medio_id_fk", + "tableFrom": "artista", + "tableTo": "medio", + "columnsFrom": [ + "logotipo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "artista_logotipo_claro_id_medio_id_fk": { + "name": "artista_logotipo_claro_id_medio_id_fk", + "tableFrom": "artista", + "tableTo": "medio", + "columnsFrom": [ + "logotipo_claro_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "artista_logotipo_oscuro_id_medio_id_fk": { + "name": "artista_logotipo_oscuro_id_medio_id_fk", + "tableFrom": "artista", + "tableTo": "medio", + "columnsFrom": [ + "logotipo_oscuro_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "artista_pais_codigo_pais_codigo_fk": { + "name": "artista_pais_codigo_pais_codigo_fk", + "tableFrom": "artista", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "artista_tipo_conocido": { + "name": "artista_tipo_conocido", + "value": "\"artista\".\"tipo\" in ('persona', 'grupo', 'proyecto', 'virtual')" + }, + "artista_nombre_visual_conocido": { + "name": "artista_nombre_visual_conocido", + "value": "\"artista\".\"nombre_visual\" in ('texto', 'logotipo')" + }, + "artista_estado_conocido": { + "name": "artista_estado_conocido", + "value": "\"artista\".\"estado\" in ('borrador', 'publicado', 'retirado')" + }, + "artista_secciones_array": { + "name": "artista_secciones_array", + "value": "jsonb_typeof(\"artista\".\"secciones\") = 'array'" + }, + "artista_presentacion_objeto": { + "name": "artista_presentacion_objeto", + "value": "jsonb_typeof(\"artista\".\"presentacion\") = 'object'" + }, + "artista_periodo_valido": { + "name": "artista_periodo_valido", + "value": "\"artista\".\"fin\" is null or \"artista\".\"inicio\" is null or \"artista\".\"fin\" >= \"artista\".\"inicio\"" + } + }, + "isRLSEnabled": false + }, + "public.artista_identificador": { + "name": "artista_identificador", + "schema": "", + "columns": { + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sistema": { + "name": "sistema", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "valor": { + "name": "valor", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "artista_identificador_externo_unico": { + "name": "artista_identificador_externo_unico", + "columns": [ + { + "expression": "sistema", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "valor", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "artista_identificador_artista_id_artista_id_fk": { + "name": "artista_identificador_artista_id_artista_id_fk", + "tableFrom": "artista_identificador", + "tableTo": "artista", + "columnsFrom": [ + "artista_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "artista_identificador_artista_id_sistema_pk": { + "name": "artista_identificador_artista_id_sistema_pk", + "columns": [ + "artista_id", + "sistema" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artista_persona": { + "name": "artista_persona", + "schema": "", + "columns": { + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "relacion": { + "name": "relacion", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "desde": { + "name": "desde", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hasta": { + "name": "hasta", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "artista_persona_persona": { + "name": "artista_persona_persona", + "columns": [ + { + "expression": "persona_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "artista_persona_artista_id_artista_id_fk": { + "name": "artista_persona_artista_id_artista_id_fk", + "tableFrom": "artista_persona", + "tableTo": "artista", + "columnsFrom": [ + "artista_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "artista_persona_persona_id_persona_id_fk": { + "name": "artista_persona_persona_id_persona_id_fk", + "tableFrom": "artista_persona", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "artista_persona_artista_id_persona_id_relacion_pk": { + "name": "artista_persona_artista_id_persona_id_relacion_pk", + "columns": [ + "artista_id", + "persona_id", + "relacion" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "artista_persona_periodo_valido": { + "name": "artista_persona_periodo_valido", + "value": "\"artista_persona\".\"hasta\" is null or \"artista_persona\".\"desde\" is null or \"artista_persona\".\"hasta\" >= \"artista_persona\".\"desde\"" + } + }, + "isRLSEnabled": false + }, + "public.album": { + "name": "album", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estilo_id": { + "name": "estilo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'album'" + }, + "fecha": { + "name": "fecha", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "portada_id": { + "name": "portada_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sello": { + "name": "sello", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "destacado": { + "name": "destacado", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "numero_catalogo": { + "name": "numero_catalogo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "formatos": { + "name": "formatos", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "pais_edicion_codigo": { + "name": "pais_edicion_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "album_estilo": { + "name": "album_estilo", + "columns": [ + { + "expression": "estilo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "album_fecha": { + "name": "album_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "album_estilo_id_estilo_id_fk": { + "name": "album_estilo_id_estilo_id_fk", + "tableFrom": "album", + "tableTo": "estilo", + "columnsFrom": [ + "estilo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "album_portada_id_medio_id_fk": { + "name": "album_portada_id_medio_id_fk", + "tableFrom": "album", + "tableTo": "medio", + "columnsFrom": [ + "portada_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "album_pais_edicion_codigo_pais_codigo_fk": { + "name": "album_pais_edicion_codigo_pais_codigo_fk", + "tableFrom": "album", + "tableTo": "pais", + "columnsFrom": [ + "pais_edicion_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "album_slug_unique": { + "name": "album_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": { + "album_secciones_array": { + "name": "album_secciones_array", + "value": "jsonb_typeof(\"album\".\"secciones\") = 'array'" + }, + "album_presentacion_objeto": { + "name": "album_presentacion_objeto", + "value": "jsonb_typeof(\"album\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.album_enlace": { + "name": "album_enlace", + "schema": "", + "columns": { + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "album_enlace_album_id_album_id_fk": { + "name": "album_enlace_album_id_album_id_fk", + "tableFrom": "album_enlace", + "tableTo": "album", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "album_enlace_album_id_plataforma_pk": { + "name": "album_enlace_album_id_plataforma_pk", + "columns": [ + "album_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.autoria": { + "name": "autoria", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "porcentaje": { + "name": "porcentaje", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "autoria_cancion_id_cancion_id_fk": { + "name": "autoria_cancion_id_cancion_id_fk", + "tableFrom": "autoria", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "autoria_persona_id_persona_id_fk": { + "name": "autoria_persona_id_persona_id_fk", + "tableFrom": "autoria", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "autoria_cancion_id_persona_id_rol_pk": { + "name": "autoria_cancion_id_persona_id_rol_pk", + "columns": [ + "cancion_id", + "persona_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion": { + "name": "cancion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'CAN-' || lpad(nextval('cancion_codigo_seq')::text, 6, '0')" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_de_id": { + "name": "version_de_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_nombre": { + "name": "version_nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_nota": { + "name": "version_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_codigo": { + "name": "version_codigo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_orden": { + "name": "version_orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "estilo_id": { + "name": "estilo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duracion_s": { + "name": "duracion_s", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ano": { + "name": "ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "letra": { + "name": "letra", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inspiracion": { + "name": "inspiracion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inspiracion_secciones": { + "name": "inspiracion_secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "tiene_letra": { + "name": "tiene_letra", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "formacion_vocal": { + "name": "formacion_vocal", + "type": "formacion_vocal", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "acceso": { + "name": "acceso", + "type": "acceso_cancion", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'publico'" + }, + "destacada": { + "name": "destacada", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "portada_id": { + "name": "portada_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ala_venta": { + "name": "ala_venta", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "cancion_codigo_unico": { + "name": "cancion_codigo_unico", + "columns": [ + { + "expression": "codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_estilo": { + "name": "cancion_estilo", + "columns": [ + { + "expression": "estilo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_album": { + "name": "cancion_album", + "columns": [ + { + "expression": "album_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_version_de": { + "name": "cancion_version_de", + "columns": [ + { + "expression": "version_de_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_destacada": { + "name": "cancion_destacada", + "columns": [ + { + "expression": "destacada", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_version_codigo_unico": { + "name": "cancion_version_codigo_unico", + "columns": [ + { + "expression": "version_de_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"cancion\".\"version_de_id\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "cancion_estilo_id_estilo_id_fk": { + "name": "cancion_estilo_id_estilo_id_fk", + "tableFrom": "cancion", + "tableTo": "estilo", + "columnsFrom": [ + "estilo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "cancion_album_id_album_id_fk": { + "name": "cancion_album_id_album_id_fk", + "tableFrom": "cancion", + "tableTo": "album", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "cancion_portada_id_medio_id_fk": { + "name": "cancion_portada_id_medio_id_fk", + "tableFrom": "cancion", + "tableTo": "medio", + "columnsFrom": [ + "portada_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "cancion_slug_unique": { + "name": "cancion_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": { + "cancion_version_codigo_presente": { + "name": "cancion_version_codigo_presente", + "value": "(\"cancion\".\"version_de_id\" is null and \"cancion\".\"version_codigo\" is null) or (\"cancion\".\"version_de_id\" is not null and nullif(btrim(\"cancion\".\"version_codigo\"), '') is not null)" + }, + "cancion_version_no_se_vende": { + "name": "cancion_version_no_se_vende", + "value": "\"cancion\".\"version_de_id\" is null or not \"cancion\".\"ala_venta\"" + }, + "cancion_idioma_bcp47": { + "name": "cancion_idioma_bcp47", + "value": "\"cancion\".\"idioma\" ~ '^[a-z]{2,8}(-[A-Za-z0-9]{1,8})*$'" + }, + "cancion_estado_conocido": { + "name": "cancion_estado_conocido", + "value": "\"cancion\".\"estado\" in ('borrador', 'publicado', 'retirado')" + }, + "cancion_inspiracion_secciones_array": { + "name": "cancion_inspiracion_secciones_array", + "value": "jsonb_typeof(\"cancion\".\"inspiracion_secciones\") = 'array'" + }, + "cancion_presentacion_objeto": { + "name": "cancion_presentacion_objeto", + "value": "jsonb_typeof(\"cancion\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.cancion_audio": { + "name": "cancion_audio", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "medio_id": { + "name": "medio_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uso": { + "name": "uso", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "formato": { + "name": "formato", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bitrate_kbps": { + "name": "bitrate_kbps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "frecuencia_hz": { + "name": "frecuencia_hz", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bits_muestra": { + "name": "bits_muestra", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "canales": { + "name": "canales", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "cancion_audio_medio_unico": { + "name": "cancion_audio_medio_unico", + "columns": [ + { + "expression": "medio_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cancion_audio_cancion": { + "name": "cancion_audio_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "cancion_audio_cancion_id_cancion_id_fk": { + "name": "cancion_audio_cancion_id_cancion_id_fk", + "tableFrom": "cancion_audio", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cancion_audio_medio_id_medio_id_fk": { + "name": "cancion_audio_medio_id_medio_id_fk", + "tableFrom": "cancion_audio", + "tableTo": "medio", + "columnsFrom": [ + "medio_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_audio_cancion_id_uso_formato_pk": { + "name": "cancion_audio_cancion_id_uso_formato_pk", + "columns": [ + "cancion_id", + "uso", + "formato" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "cancion_audio_uso_conocido": { + "name": "cancion_audio_uso_conocido", + "value": "\"cancion_audio\".\"uso\" in ('stream', 'descarga', 'master')" + }, + "cancion_audio_bitrate_valido": { + "name": "cancion_audio_bitrate_valido", + "value": "\"cancion_audio\".\"bitrate_kbps\" is null or \"cancion_audio\".\"bitrate_kbps\" > 0" + }, + "cancion_audio_frecuencia_valida": { + "name": "cancion_audio_frecuencia_valida", + "value": "\"cancion_audio\".\"frecuencia_hz\" is null or \"cancion_audio\".\"frecuencia_hz\" > 0" + }, + "cancion_audio_bits_validos": { + "name": "cancion_audio_bits_validos", + "value": "\"cancion_audio\".\"bits_muestra\" is null or \"cancion_audio\".\"bits_muestra\" > 0" + }, + "cancion_audio_canales_validos": { + "name": "cancion_audio_canales_validos", + "value": "\"cancion_audio\".\"canales\" is null or \"cancion_audio\".\"canales\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.cancion_enlace": { + "name": "cancion_enlace", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_enlace_cancion_id_cancion_id_fk": { + "name": "cancion_enlace_cancion_id_cancion_id_fk", + "tableFrom": "cancion_enlace", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_enlace_cancion_id_plataforma_pk": { + "name": "cancion_enlace_cancion_id_plataforma_pk", + "columns": [ + "cancion_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_etiqueta": { + "name": "cancion_etiqueta", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_etiqueta_cancion_id_cancion_id_fk": { + "name": "cancion_etiqueta_cancion_id_cancion_id_fk", + "tableFrom": "cancion_etiqueta", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cancion_etiqueta_etiqueta_id_etiqueta_id_fk": { + "name": "cancion_etiqueta_etiqueta_id_etiqueta_id_fk", + "tableFrom": "cancion_etiqueta", + "tableTo": "etiqueta", + "columnsFrom": [ + "etiqueta_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_etiqueta_cancion_id_etiqueta_id_pk": { + "name": "cancion_etiqueta_cancion_id_etiqueta_id_pk", + "columns": [ + "cancion_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_interprete": { + "name": "cancion_interprete", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'principal'" + }, + "instrumento": { + "name": "instrumento", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acreditado_como": { + "name": "acreditado_como", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "cancion_interprete_artista": { + "name": "cancion_interprete_artista", + "columns": [ + { + "expression": "artista_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "cancion_interprete_cancion_id_cancion_id_fk": { + "name": "cancion_interprete_cancion_id_cancion_id_fk", + "tableFrom": "cancion_interprete", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cancion_interprete_artista_id_artista_id_fk": { + "name": "cancion_interprete_artista_id_artista_id_fk", + "tableFrom": "cancion_interprete", + "tableTo": "artista", + "columnsFrom": [ + "artista_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_interprete_cancion_id_artista_id_rol_pk": { + "name": "cancion_interprete_cancion_id_artista_id_rol_pk", + "columns": [ + "cancion_id", + "artista_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "cancion_interprete_rol_conocido": { + "name": "cancion_interprete_rol_conocido", + "value": "\"cancion_interprete\".\"rol\" in ('principal', 'invitado', 'coros', 'instrumentista')" + } + }, + "isRLSEnabled": false + }, + "public.cancion_persona": { + "name": "cancion_persona", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_persona_cancion_id_cancion_id_fk": { + "name": "cancion_persona_cancion_id_cancion_id_fk", + "tableFrom": "cancion_persona", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cancion_persona_persona_id_persona_id_fk": { + "name": "cancion_persona_persona_id_persona_id_fk", + "tableFrom": "cancion_persona", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_persona_cancion_id_persona_id_rol_pk": { + "name": "cancion_persona_cancion_id_persona_id_rol_pk", + "columns": [ + "cancion_id", + "persona_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credito_album": { + "name": "credito_album", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "credito_album_album": { + "name": "credito_album_album", + "columns": [ + { + "expression": "album_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credito_album_album_id_album_id_fk": { + "name": "credito_album_album_id_album_id_fk", + "tableFrom": "credito_album", + "tableTo": "album", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credito_album_persona_id_persona_id_fk": { + "name": "credito_album_persona_id_persona_id_fk", + "tableFrom": "credito_album", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.estilo": { + "name": "estilo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "estilo_principal_unico": { + "name": "estilo_principal_unico", + "columns": [ + { + "expression": "principal", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"estilo\".\"principal\"", + "concurrently": false, + "method": "btree", + "with": {} + }, + "estilo_orden": { + "name": "estilo_orden", + "columns": [ + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "estilo_imagen_id_medio_id_fk": { + "name": "estilo_imagen_id_medio_id_fk", + "tableFrom": "estilo", + "tableTo": "medio", + "columnsFrom": [ + "imagen_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "estilo_slug_unique": { + "name": "estilo_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.etiqueta": { + "name": "etiqueta", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "etiqueta_slug_unique": { + "name": "etiqueta_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.registro_obra": { + "name": "registro_obra", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "iswc": { + "name": "iswc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isrc": { + "name": "isrc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "entidad": { + "name": "entidad", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numero": { + "name": "numero", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "editorial": { + "name": "editorial", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "registro_obra_cancion_id_cancion_id_fk": { + "name": "registro_obra_cancion_id_cancion_id_fk", + "tableFrom": "registro_obra", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.traduccion": { + "name": "traduccion", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "traduccion_cancion_id_cancion_id_fk": { + "name": "traduccion_cancion_id_cancion_id_fk", + "tableFrom": "traduccion", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "traduccion_cancion_id_idioma_pk": { + "name": "traduccion_cancion_id_idioma_pk", + "columns": [ + "cancion_id", + "idioma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.video": { + "name": "video", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "youtube_id": { + "name": "youtube_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "video_cancion": { + "name": "video_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "video_cancion_id_cancion_id_fk": { + "name": "video_cancion_id_cancion_id_fk", + "tableFrom": "video", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.acepcion": { + "name": "acepcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "categoria": { + "name": "categoria", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "definicion": { + "name": "definicion", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ampliacion": { + "name": "ampliacion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ejemplo": { + "name": "ejemplo", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "acepcion_numero": { + "name": "acepcion_numero", + "columns": [ + { + "expression": "termino_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "numero", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "acepcion_termino_id_termino_id_fk": { + "name": "acepcion_termino_id_termino_id_fk", + "tableFrom": "acepcion", + "tableTo": "termino", + "columnsFrom": [ + "termino_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.animo": { + "name": "animo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gems": { + "name": "gems", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valencia": { + "name": "valencia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "energia": { + "name": "energia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "animo_codigo_unique": { + "name": "animo_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_genero": { + "name": "cancion_genero", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_genero_cancion_id_cancion_id_fk": { + "name": "cancion_genero_cancion_id_cancion_id_fk", + "tableFrom": "cancion_genero", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cancion_genero_genero_id_genero_id_fk": { + "name": "cancion_genero_genero_id_genero_id_fk", + "tableFrom": "cancion_genero", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_genero_cancion_id_genero_id_pk": { + "name": "cancion_genero_cancion_id_genero_id_pk", + "columns": [ + "cancion_id", + "genero_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.capitulo": { + "name": "capitulo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "capitulo_tipo": { + "name": "capitulo_tipo", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "capitulo_genero_id_genero_id_fk": { + "name": "capitulo_genero_id_genero_id_fk", + "tableFrom": "capitulo", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "capitulo_slug_unique": { + "name": "capitulo_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.capitulo_acepcion": { + "name": "capitulo_acepcion", + "schema": "", + "columns": { + "capitulo_id": { + "name": "capitulo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "acepcion_id": { + "name": "acepcion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "automatico": { + "name": "automatico", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "confirmado": { + "name": "confirmado", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "capitulo_acepcion_capitulo_id_capitulo_id_fk": { + "name": "capitulo_acepcion_capitulo_id_capitulo_id_fk", + "tableFrom": "capitulo_acepcion", + "tableTo": "capitulo", + "columnsFrom": [ + "capitulo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "capitulo_acepcion_acepcion_id_acepcion_id_fk": { + "name": "capitulo_acepcion_acepcion_id_acepcion_id_fk", + "tableFrom": "capitulo_acepcion", + "tableTo": "acepcion", + "columnsFrom": [ + "acepcion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "capitulo_acepcion_capitulo_id_acepcion_id_pk": { + "name": "capitulo_acepcion_capitulo_id_acepcion_id_pk", + "columns": [ + "capitulo_id", + "acepcion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.compas": { + "name": "compas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numerador": { + "name": "numerador", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "denominador": { + "name": "denominador", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "compas_codigo_unique": { + "name": "compas_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero": { + "name": "genero", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "origen_lugar": { + "name": "origen_lugar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "origen_ano": { + "name": "origen_ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tempo": { + "name": "tempo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metrica_nota": { + "name": "metrica_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "compas_nota": { + "name": "compas_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rasgos": { + "name": "rasgos", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "genero_nombre": { + "name": "genero_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "genero_origen_ano": { + "name": "genero_origen_ano", + "columns": [ + { + "expression": "origen_ano", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "genero_slug_unique": { + "name": "genero_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_alias": { + "name": "genero_alias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "genero_alias_nombre": { + "name": "genero_alias_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "genero_alias_genero_id_genero_id_fk": { + "name": "genero_alias_genero_id_genero_id_fk", + "tableFrom": "genero_alias", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_alias_pais_codigo_pais_codigo_fk": { + "name": "genero_alias_pais_codigo_pais_codigo_fk", + "tableFrom": "genero_alias", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_compas": { + "name": "genero_compas", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "compas_id": { + "name": "compas_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_compas_genero_id_genero_id_fk": { + "name": "genero_compas_genero_id_genero_id_fk", + "tableFrom": "genero_compas", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_compas_compas_id_compas_id_fk": { + "name": "genero_compas_compas_id_compas_id_fk", + "tableFrom": "genero_compas", + "tableTo": "compas", + "columnsFrom": [ + "compas_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_compas_genero_id_compas_id_pk": { + "name": "genero_compas_genero_id_compas_id_pk", + "columns": [ + "genero_id", + "compas_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_instrumento": { + "name": "genero_instrumento", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instrumento_id": { + "name": "instrumento_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "importancia": { + "name": "importancia", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'habitual'" + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_instrumento_genero_id_genero_id_fk": { + "name": "genero_instrumento_genero_id_genero_id_fk", + "tableFrom": "genero_instrumento", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_instrumento_instrumento_id_instrumento_id_fk": { + "name": "genero_instrumento_instrumento_id_instrumento_id_fk", + "tableFrom": "genero_instrumento", + "tableTo": "instrumento", + "columnsFrom": [ + "instrumento_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_instrumento_genero_id_instrumento_id_pk": { + "name": "genero_instrumento_genero_id_instrumento_id_pk", + "columns": [ + "genero_id", + "instrumento_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_metro": { + "name": "genero_metro", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metro_id": { + "name": "metro_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "predominante": { + "name": "predominante", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_metro_genero_id_genero_id_fk": { + "name": "genero_metro_genero_id_genero_id_fk", + "tableFrom": "genero_metro", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_metro_metro_id_metro_id_fk": { + "name": "genero_metro_metro_id_metro_id_fk", + "tableFrom": "genero_metro", + "tableTo": "metro", + "columnsFrom": [ + "metro_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_metro_genero_id_metro_id_pk": { + "name": "genero_metro_genero_id_metro_id_pk", + "columns": [ + "genero_id", + "metro_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_origen": { + "name": "genero_origen", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "origen_id": { + "name": "origen_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "genero_origen_origen": { + "name": "genero_origen_origen", + "columns": [ + { + "expression": "origen_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "genero_origen_genero_id_genero_id_fk": { + "name": "genero_origen_genero_id_genero_id_fk", + "tableFrom": "genero_origen", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_origen_origen_id_genero_id_fk": { + "name": "genero_origen_origen_id_genero_id_fk", + "tableFrom": "genero_origen", + "tableTo": "genero", + "columnsFrom": [ + "origen_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_origen_genero_id_origen_id_tipo_pk": { + "name": "genero_origen_genero_id_origen_id_tipo_pk", + "columns": [ + "genero_id", + "origen_id", + "tipo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_pais": { + "name": "genero_pais", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + }, + "relacion": { + "name": "relacion", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'adoptado'" + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_pais_genero_id_genero_id_fk": { + "name": "genero_pais_genero_id_genero_id_fk", + "tableFrom": "genero_pais", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_pais_pais_codigo_pais_codigo_fk": { + "name": "genero_pais_pais_codigo_pais_codigo_fk", + "tableFrom": "genero_pais", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_pais_genero_id_pais_codigo_pk": { + "name": "genero_pais_genero_id_pais_codigo_pk", + "columns": [ + "genero_id", + "pais_codigo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_persona": { + "name": "genero_persona", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_persona_genero_id_genero_id_fk": { + "name": "genero_persona_genero_id_genero_id_fk", + "tableFrom": "genero_persona", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_persona_persona_id_persona_id_fk": { + "name": "genero_persona_persona_id_persona_id_fk", + "tableFrom": "genero_persona", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_persona_genero_id_persona_id_papel_pk": { + "name": "genero_persona_genero_id_persona_id_papel_pk", + "columns": [ + "genero_id", + "persona_id", + "papel" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_seccion": { + "name": "genero_seccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "clave": { + "name": "clave", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "genero_seccion_clave": { + "name": "genero_seccion_clave", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "clave", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "genero_seccion_genero_id_genero_id_fk": { + "name": "genero_seccion_genero_id_genero_id_fk", + "tableFrom": "genero_seccion", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_tema": { + "name": "genero_tema", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_tema_genero_id_genero_id_fk": { + "name": "genero_tema_genero_id_genero_id_fk", + "tableFrom": "genero_tema", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "genero_tema_etiqueta_id_etiqueta_id_fk": { + "name": "genero_tema_etiqueta_id_etiqueta_id_fk", + "tableFrom": "genero_tema", + "tableTo": "etiqueta", + "columnsFrom": [ + "etiqueta_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "genero_tema_genero_id_etiqueta_id_pk": { + "name": "genero_tema_genero_id_etiqueta_id_pk", + "columns": [ + "genero_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instrumento": { + "name": "instrumento", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "familia": { + "name": "familia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subfamilia": { + "name": "subfamilia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "afinacion": { + "name": "afinacion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "muestra_id": { + "name": "muestra_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "instrumento_familia": { + "name": "instrumento_familia", + "columns": [ + { + "expression": "familia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "instrumento_pais_codigo_pais_codigo_fk": { + "name": "instrumento_pais_codigo_pais_codigo_fk", + "tableFrom": "instrumento", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "instrumento_imagen_id_medio_id_fk": { + "name": "instrumento_imagen_id_medio_id_fk", + "tableFrom": "instrumento", + "tableTo": "medio", + "columnsFrom": [ + "imagen_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "instrumento_muestra_id_medio_id_fk": { + "name": "instrumento_muestra_id_medio_id_fk", + "tableFrom": "instrumento", + "tableTo": "medio", + "columnsFrom": [ + "muestra_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "instrumento_slug_unique": { + "name": "instrumento_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.metro": { + "name": "metro", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "silabas": { + "name": "silabas", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "metro_codigo_unique": { + "name": "metro_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.modelo_ia": { + "name": "modelo_ia", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "familia": { + "name": "familia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vigente": { + "name": "vigente", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "nota_sintaxis": { + "name": "nota_sintaxis", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "esquema": { + "name": "esquema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "modelo_ia_familia": { + "name": "modelo_ia_familia", + "columns": [ + { + "expression": "familia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "modelo_ia_codigo_unique": { + "name": "modelo_ia_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia": { + "name": "obra_referencia", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ano": { + "name": "ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cita": { + "name": "cita", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "obra_referencia_genero": { + "name": "obra_referencia_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "obra_referencia_genero_id_genero_id_fk": { + "name": "obra_referencia_genero_id_genero_id_fk", + "tableFrom": "obra_referencia", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "obra_referencia_slug_unique": { + "name": "obra_referencia_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia_enlace": { + "name": "obra_referencia_enlace", + "schema": "", + "columns": { + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "obra_referencia_enlace_obra_id_obra_referencia_id_fk": { + "name": "obra_referencia_enlace_obra_id_obra_referencia_id_fk", + "tableFrom": "obra_referencia_enlace", + "tableTo": "obra_referencia", + "columnsFrom": [ + "obra_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "obra_referencia_enlace_obra_id_plataforma_pk": { + "name": "obra_referencia_enlace_obra_id_plataforma_pk", + "columns": [ + "obra_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia_persona": { + "name": "obra_referencia_persona", + "schema": "", + "columns": { + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "obra_referencia_persona_obra_id_obra_referencia_id_fk": { + "name": "obra_referencia_persona_obra_id_obra_referencia_id_fk", + "tableFrom": "obra_referencia_persona", + "tableTo": "obra_referencia", + "columnsFrom": [ + "obra_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "obra_referencia_persona_persona_id_persona_id_fk": { + "name": "obra_referencia_persona_persona_id_persona_id_fk", + "tableFrom": "obra_referencia_persona", + "tableTo": "persona", + "columnsFrom": [ + "persona_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "obra_referencia_persona_obra_id_persona_id_papel_pk": { + "name": "obra_referencia_persona_obra_id_persona_id_papel_pk", + "columns": [ + "obra_id", + "persona_id", + "papel" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.prompt": { + "name": "prompt", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "modelo_ia_id": { + "name": "modelo_ia_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "animo_id": { + "name": "animo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'en'" + }, + "contenido": { + "name": "contenido", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "notas": { + "name": "notas", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valoracion": { + "name": "valoracion", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ejemplo_id": { + "name": "ejemplo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preferido": { + "name": "preferido", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "visibilidad": { + "name": "visibilidad", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'privado'" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "prompt_genero": { + "name": "prompt_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prompt_cancion": { + "name": "prompt_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prompt_modelo": { + "name": "prompt_modelo", + "columns": [ + { + "expression": "modelo_ia_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "prompt_animo": { + "name": "prompt_animo", + "columns": [ + { + "expression": "animo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "prompt_modelo_ia_id_modelo_ia_id_fk": { + "name": "prompt_modelo_ia_id_modelo_ia_id_fk", + "tableFrom": "prompt", + "tableTo": "modelo_ia", + "columnsFrom": [ + "modelo_ia_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "prompt_genero_id_genero_id_fk": { + "name": "prompt_genero_id_genero_id_fk", + "tableFrom": "prompt", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "prompt_cancion_id_cancion_id_fk": { + "name": "prompt_cancion_id_cancion_id_fk", + "tableFrom": "prompt", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "prompt_animo_id_animo_id_fk": { + "name": "prompt_animo_id_animo_id_fk", + "tableFrom": "prompt", + "tableTo": "animo", + "columnsFrom": [ + "animo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "prompt_ejemplo_id_medio_id_fk": { + "name": "prompt_ejemplo_id_medio_id_fk", + "tableFrom": "prompt", + "tableTo": "medio", + "columnsFrom": [ + "ejemplo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.termino": { + "name": "termino", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "termino": { + "name": "termino", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "termino_slug_unique": { + "name": "termino_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + }, + "termino_termino_unique": { + "name": "termino_termino_unique", + "nullsNotDistinct": false, + "columns": [ + "termino" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.termino_variante": { + "name": "termino_variante", + "schema": "", + "columns": { + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "forma": { + "name": "forma", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "termino_variante_termino_id_termino_id_fk": { + "name": "termino_variante_termino_id_termino_id_fk", + "tableFrom": "termino_variante", + "tableTo": "termino", + "columnsFrom": [ + "termino_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "termino_variante_termino_id_forma_pk": { + "name": "termino_variante_termino_id_forma_pk", + "columns": [ + "termino_id", + "forma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verso": { + "name": "verso", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ilustra": { + "name": "ilustra", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fuente": { + "name": "fuente", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ejemplo'" + }, + "analisis": { + "name": "analisis", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "medida": { + "name": "medida", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "verso_genero": { + "name": "verso_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "verso_genero_id_genero_id_fk": { + "name": "verso_genero_id_genero_id_fk", + "tableFrom": "verso", + "tableTo": "genero", + "columnsFrom": [ + "genero_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "verso_obra_id_obra_referencia_id_fk": { + "name": "verso_obra_id_obra_referencia_id_fk", + "tableFrom": "verso", + "tableTo": "obra_referencia", + "columnsFrom": [ + "obra_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "verso_cancion_id_cancion_id_fk": { + "name": "verso_cancion_id_cancion_id_fk", + "tableFrom": "verso", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verso_linea": { + "name": "verso_linea", + "schema": "", + "columns": { + "verso_id": { + "name": "verso_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "silabas": { + "name": "silabas", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "tonicas": { + "name": "tonicas", + "type": "integer[]", + "primaryKey": false, + "notNull": false + }, + "medida": { + "name": "medida", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "verso_linea_verso_id_verso_id_fk": { + "name": "verso_linea_verso_id_verso_id_fk", + "tableFrom": "verso_linea", + "tableTo": "verso", + "columnsFrom": [ + "verso_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "verso_linea_verso_id_numero_pk": { + "name": "verso_linea_verso_id_numero_pk", + "columns": [ + "verso_id", + "numero" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documento_legal": { + "name": "documento_legal", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "version_vigente_id": { + "name": "version_vigente_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "documento_legal_slug_unique": { + "name": "documento_legal_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entrada": { + "name": "entrada", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fecha": { + "name": "fecha", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "entrada_fecha": { + "name": "entrada_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "entrada_imagen_id_medio_id_fk": { + "name": "entrada_imagen_id_medio_id_fk", + "tableFrom": "entrada", + "tableTo": "medio", + "columnsFrom": [ + "imagen_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "entrada_slug_unique": { + "name": "entrada_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": { + "entrada_secciones_array": { + "name": "entrada_secciones_array", + "value": "jsonb_typeof(\"entrada\".\"secciones\") = 'array'" + }, + "entrada_presentacion_objeto": { + "name": "entrada_presentacion_objeto", + "value": "jsonb_typeof(\"entrada\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.entrada_cancion": { + "name": "entrada_cancion", + "schema": "", + "columns": { + "entrada_id": { + "name": "entrada_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "entrada_cancion_entrada_id_entrada_id_fk": { + "name": "entrada_cancion_entrada_id_entrada_id_fk", + "tableFrom": "entrada_cancion", + "tableTo": "entrada", + "columnsFrom": [ + "entrada_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "entrada_cancion_cancion_id_cancion_id_fk": { + "name": "entrada_cancion_cancion_id_cancion_id_fk", + "tableFrom": "entrada_cancion", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "entrada_cancion_entrada_id_cancion_id_pk": { + "name": "entrada_cancion_entrada_id_cancion_id_pk", + "columns": [ + "entrada_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entrada_etiqueta": { + "name": "entrada_etiqueta", + "schema": "", + "columns": { + "entrada_id": { + "name": "entrada_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "entrada_etiqueta_entrada_id_entrada_id_fk": { + "name": "entrada_etiqueta_entrada_id_entrada_id_fk", + "tableFrom": "entrada_etiqueta", + "tableTo": "entrada", + "columnsFrom": [ + "entrada_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "entrada_etiqueta_etiqueta_id_etiqueta_id_fk": { + "name": "entrada_etiqueta_etiqueta_id_etiqueta_id_fk", + "tableFrom": "entrada_etiqueta", + "tableTo": "etiqueta", + "columnsFrom": [ + "etiqueta_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "entrada_etiqueta_entrada_id_etiqueta_id_pk": { + "name": "entrada_etiqueta_entrada_id_etiqueta_id_pk", + "columns": [ + "entrada_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pagina": { + "name": "pagina", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pagina_slug_unique": { + "name": "pagina_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.redireccion": { + "name": "redireccion", + "schema": "", + "columns": { + "desde": { + "name": "desde", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "hacia": { + "name": "hacia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permanente": { + "name": "permanente", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "motivo": { + "name": "motivo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "redireccion_hacia": { + "name": "redireccion_hacia", + "columns": [ + { + "expression": "hacia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.version_legal": { + "name": "version_legal", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "documento_id": { + "name": "documento_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vigente_desde": { + "name": "vigente_desde", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "resumen_cambios": { + "name": "resumen_cambios", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "version_legal_documento": { + "name": "version_legal_documento", + "columns": [ + { + "expression": "documento_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vigente_desde", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "version_legal_documento_id_documento_legal_id_fk": { + "name": "version_legal_documento_id_documento_legal_id_fk", + "tableFrom": "version_legal", + "tableTo": "documento_legal", + "columnsFrom": [ + "documento_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contador_factura": { + "name": "contador_factura", + "schema": "", + "columns": { + "serie": { + "name": "serie", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "ultimo_numero": { + "name": "ultimo_numero", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datos_facturacion": { + "name": "datos_facturacion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'particular'" + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nif": { + "name": "nif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "direccion": { + "name": "direccion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cp": { + "name": "cp", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ciudad": { + "name": "ciudad", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + }, + "predeterminada": { + "name": "predeterminada", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "datos_facturacion_usuario": { + "name": "datos_facturacion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "datos_facturacion_usuario_id_usuario_id_fk": { + "name": "datos_facturacion_usuario_id_usuario_id_fk", + "tableFrom": "datos_facturacion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "datos_facturacion_pais_codigo_pais_codigo_fk": { + "name": "datos_facturacion_pais_codigo_pais_codigo_fk", + "tableFrom": "datos_facturacion", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.descarga": { + "name": "descarga", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bajada_en": { + "name": "bajada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "agente": { + "name": "agente", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "descarga_usuario": { + "name": "descarga_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "descarga_fecha": { + "name": "descarga_fecha", + "columns": [ + { + "expression": "bajada_en", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "descarga_usuario_id_usuario_id_fk": { + "name": "descarga_usuario_id_usuario_id_fk", + "tableFrom": "descarga", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "descarga_cancion_id_cancion_id_fk": { + "name": "descarga_cancion_id_cancion_id_fk", + "tableFrom": "descarga", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.factura": { + "name": "factura", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "serie": { + "name": "serie", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'normal'" + }, + "rectifica_a_id": { + "name": "rectifica_a_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fecha": { + "name": "fecha", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "base_centimos": { + "name": "base_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "iva_tipo": { + "name": "iva_tipo", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "iva_cuota_centimos": { + "name": "iva_cuota_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "datos_congelados": { + "name": "datos_congelados", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "factura_serie_numero": { + "name": "factura_serie_numero", + "columns": [ + { + "expression": "serie", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "numero", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "factura_pedido": { + "name": "factura_pedido", + "columns": [ + { + "expression": "pedido_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "factura_fecha": { + "name": "factura_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "factura_pedido_id_pedido_id_fk": { + "name": "factura_pedido_id_pedido_id_fk", + "tableFrom": "factura", + "tableTo": "pedido", + "columnsFrom": [ + "pedido_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "factura_pais_codigo_pais_codigo_fk": { + "name": "factura_pais_codigo_pais_codigo_fk", + "tableFrom": "factura", + "tableTo": "pais", + "columnsFrom": [ + "pais_codigo" + ], + "columnsTo": [ + "codigo" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.codigo_acceso": { + "name": "codigo_acceso", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "intentos": { + "name": "intentos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "usado_en": { + "name": "usado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "codigo_acceso_email": { + "name": "codigo_acceso_email", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.identidad": { + "name": "identidad", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "proveedor": { + "name": "proveedor", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sujeto": { + "name": "sujeto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ultimo_acceso_en": { + "name": "ultimo_acceso_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "identidad_proveedor_sujeto": { + "name": "identidad_proveedor_sujeto", + "columns": [ + { + "expression": "proveedor", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sujeto", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "identidad_usuario": { + "name": "identidad_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "identidad_usuario_id_usuario_id_fk": { + "name": "identidad_usuario_id_usuario_id_fk", + "tableFrom": "identidad", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.limite": { + "name": "limite", + "schema": "", + "columns": { + "clave": { + "name": "clave", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "intentos": { + "name": "intentos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "limite_expira": { + "name": "limite_expira", + "columns": [ + { + "expression": "expira_en", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plan_suscripcion": { + "name": "plan_suscripcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nivel": { + "name": "nivel", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "precio_centimos": { + "name": "precio_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "periodicidad": { + "name": "periodicidad", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intervalos": { + "name": "intervalos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "ambito": { + "name": "ambito", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'musica'" + }, + "incluye_publicidad": { + "name": "incluye_publicidad", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "calidad_escucha": { + "name": "calidad_escucha", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'media'" + }, + "descargas_incluidas": { + "name": "descargas_incluidas", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "calidad_descarga": { + "name": "calidad_descarga", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acceso_versiones": { + "name": "acceso_versiones", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "acceso_contenido_taller": { + "name": "acceso_contenido_taller", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "descarga_material_taller": { + "name": "descarga_material_taller", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "referencia_precio_externa": { + "name": "referencia_precio_externa", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prestaciones": { + "name": "prestaciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "plan_suscripcion_estado_nivel": { + "name": "plan_suscripcion_estado_nivel", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "nivel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "plan_suscripcion_codigo_unique": { + "name": "plan_suscripcion_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + }, + "plan_suscripcion_referencia_precio_externa_unique": { + "name": "plan_suscripcion_referencia_precio_externa_unique", + "nullsNotDistinct": false, + "columns": [ + "referencia_precio_externa" + ] + } + }, + "policies": {}, + "checkConstraints": { + "plan_suscripcion_periodicidad_conocida": { + "name": "plan_suscripcion_periodicidad_conocida", + "value": "\"plan_suscripcion\".\"periodicidad\" in ('dia', 'semana', 'mes', 'ano')" + }, + "plan_suscripcion_estado_conocido": { + "name": "plan_suscripcion_estado_conocido", + "value": "\"plan_suscripcion\".\"estado\" in ('borrador', 'disponible', 'retirado')" + }, + "plan_suscripcion_nivel_positivo": { + "name": "plan_suscripcion_nivel_positivo", + "value": "\"plan_suscripcion\".\"nivel\" > 0" + }, + "plan_suscripcion_precio_no_negativo": { + "name": "plan_suscripcion_precio_no_negativo", + "value": "\"plan_suscripcion\".\"precio_centimos\" >= 0" + }, + "plan_suscripcion_intervalos_positivos": { + "name": "plan_suscripcion_intervalos_positivos", + "value": "\"plan_suscripcion\".\"intervalos\" > 0" + }, + "plan_suscripcion_ambito_conocido": { + "name": "plan_suscripcion_ambito_conocido", + "value": "\"plan_suscripcion\".\"ambito\" in ('musica', 'taller_letras')" + }, + "plan_suscripcion_calidad_escucha_conocida": { + "name": "plan_suscripcion_calidad_escucha_conocida", + "value": "\"plan_suscripcion\".\"calidad_escucha\" is null or \"plan_suscripcion\".\"calidad_escucha\" in ('media', 'alta')" + }, + "plan_suscripcion_calidad_descarga_conocida": { + "name": "plan_suscripcion_calidad_descarga_conocida", + "value": "\"plan_suscripcion\".\"calidad_descarga\" is null or \"plan_suscripcion\".\"calidad_descarga\" in ('media', 'alta')" + }, + "plan_suscripcion_descargas_no_negativas": { + "name": "plan_suscripcion_descargas_no_negativas", + "value": "\"plan_suscripcion\".\"descargas_incluidas\" >= 0" + }, + "plan_suscripcion_calidad_solo_con_descargas": { + "name": "plan_suscripcion_calidad_solo_con_descargas", + "value": "\"plan_suscripcion\".\"descargas_incluidas\" > 0 or \"plan_suscripcion\".\"calidad_descarga\" is null" + }, + "plan_suscripcion_capacidades_segun_ambito": { + "name": "plan_suscripcion_capacidades_segun_ambito", + "value": "(\n\t\t\t\t\"plan_suscripcion\".\"ambito\" = 'musica'\n\t\t\t\tand \"plan_suscripcion\".\"calidad_escucha\" is not null\n\t\t\t\tand not \"plan_suscripcion\".\"acceso_contenido_taller\"\n\t\t\t\tand not \"plan_suscripcion\".\"descarga_material_taller\"\n\t\t\t) or (\n\t\t\t\t\"plan_suscripcion\".\"ambito\" = 'taller_letras'\n\t\t\t\tand \"plan_suscripcion\".\"calidad_escucha\" is null\n\t\t\t\tand not \"plan_suscripcion\".\"incluye_publicidad\"\n\t\t\t\tand \"plan_suscripcion\".\"descargas_incluidas\" = 0\n\t\t\t\tand \"plan_suscripcion\".\"calidad_descarga\" is null\n\t\t\t\tand not \"plan_suscripcion\".\"acceso_versiones\"\n\t\t\t)" + }, + "plan_suscripcion_moneda_iso": { + "name": "plan_suscripcion_moneda_iso", + "value": "\"plan_suscripcion\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "plan_suscripcion_codigo_no_vacio": { + "name": "plan_suscripcion_codigo_no_vacio", + "value": "btrim(\"plan_suscripcion\".\"codigo\") <> ''" + }, + "plan_suscripcion_nombre_no_vacio": { + "name": "plan_suscripcion_nombre_no_vacio", + "value": "btrim(\"plan_suscripcion\".\"nombre\") <> ''" + }, + "plan_suscripcion_prestaciones_array": { + "name": "plan_suscripcion_prestaciones_array", + "value": "jsonb_typeof(\"plan_suscripcion\".\"prestaciones\") = 'array'" + } + }, + "isRLSEnabled": false + }, + "public.sesion": { + "name": "sesion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sesion_usuario": { + "name": "sesion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sesion_usuario_id_usuario_id_fk": { + "name": "sesion_usuario_id_usuario_id_fk", + "tableFrom": "sesion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.suscripcion": { + "name": "suscripcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "plan_id": { + "name": "plan_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "inicia_en": { + "name": "inicia_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "termina_en": { + "name": "termina_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "proveedor": { + "name": "proveedor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "referencia_externa": { + "name": "referencia_externa", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "suscripcion_usuario_estado": { + "name": "suscripcion_usuario_estado", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "suscripcion_proveedor_referencia": { + "name": "suscripcion_proveedor_referencia", + "columns": [ + { + "expression": "proveedor", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "referencia_externa", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"suscripcion\".\"referencia_externa\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "suscripcion_plan_id_plan_suscripcion_id_fk": { + "name": "suscripcion_plan_id_plan_suscripcion_id_fk", + "tableFrom": "suscripcion", + "tableTo": "plan_suscripcion", + "columnsFrom": [ + "plan_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + }, + "suscripcion_usuario_id_usuario_id_fk": { + "name": "suscripcion_usuario_id_usuario_id_fk", + "tableFrom": "suscripcion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "suscripcion_periodo_valido": { + "name": "suscripcion_periodo_valido", + "value": "\"suscripcion\".\"termina_en\" is null or \"suscripcion\".\"termina_en\" > \"suscripcion\".\"inicia_en\"" + }, + "suscripcion_estado_conocido": { + "name": "suscripcion_estado_conocido", + "value": "\"suscripcion\".\"estado\" in ('pendiente', 'activa', 'pausada', 'cancelada', 'vencida')" + }, + "suscripcion_referencia_completa": { + "name": "suscripcion_referencia_completa", + "value": "(\"suscripcion\".\"proveedor\" is null) = (\"suscripcion\".\"referencia_externa\" is null)" + } + }, + "isRLSEnabled": false + }, + "public.usuario": { + "name": "usuario", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persona'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ultimo_acceso_en": { + "name": "ultimo_acceso_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "usuario_email_unique": { + "name": "usuario_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito": { + "name": "carrito", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "carrito_usuario_unico": { + "name": "carrito_usuario_unico", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"carrito\".\"usuario_id\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "carrito_usuario_id_usuario_id_fk": { + "name": "carrito_usuario_id_usuario_id_fk", + "tableFrom": "carrito", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito_item": { + "name": "carrito_item", + "schema": "", + "columns": { + "carrito_id": { + "name": "carrito_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "anadido_en": { + "name": "anadido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "carrito_item_carrito_id_carrito_id_fk": { + "name": "carrito_item_carrito_id_carrito_id_fk", + "tableFrom": "carrito_item", + "tableTo": "carrito", + "columnsFrom": [ + "carrito_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "carrito_item_cancion_id_cancion_id_fk": { + "name": "carrito_item_cancion_id_cancion_id_fk", + "tableFrom": "carrito_item", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "carrito_item_carrito_id_cancion_id_pk": { + "name": "carrito_item_carrito_id_cancion_id_pk", + "columns": [ + "carrito_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito_producto": { + "name": "carrito_producto", + "schema": "", + "columns": { + "carrito_id": { + "name": "carrito_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "producto_id": { + "name": "producto_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cantidad": { + "name": "cantidad", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "anadido_en": { + "name": "anadido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "carrito_producto_carrito_id_carrito_id_fk": { + "name": "carrito_producto_carrito_id_carrito_id_fk", + "tableFrom": "carrito_producto", + "tableTo": "carrito", + "columnsFrom": [ + "carrito_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "carrito_producto_producto_id_producto_id_fk": { + "name": "carrito_producto_producto_id_producto_id_fk", + "tableFrom": "carrito_producto", + "tableTo": "producto", + "columnsFrom": [ + "producto_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "carrito_producto_carrito_id_producto_id_pk": { + "name": "carrito_producto_carrito_id_producto_id_pk", + "columns": [ + "carrito_id", + "producto_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "carrito_producto_cantidad_positiva": { + "name": "carrito_producto_cantidad_positiva", + "value": "\"carrito_producto\".\"cantidad\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.compra": { + "name": "compra", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "comprado_en": { + "name": "comprado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "compra_usuario_id_usuario_id_fk": { + "name": "compra_usuario_id_usuario_id_fk", + "tableFrom": "compra", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "compra_cancion_id_cancion_id_fk": { + "name": "compra_cancion_id_cancion_id_fk", + "tableFrom": "compra", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + }, + "compra_pedido_id_pedido_id_fk": { + "name": "compra_pedido_id_pedido_id_fk", + "tableFrom": "compra", + "tableTo": "pedido", + "columnsFrom": [ + "pedido_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "compra_usuario_id_cancion_id_pk": { + "name": "compra_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.intencion_pago": { + "name": "intencion_pago", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "huella": { + "name": "huella", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "datos": { + "name": "datos", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "sesion_pago_id": { + "name": "sesion_pago_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'abierta'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "intencion_pago_abierta": { + "name": "intencion_pago_abierta", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "huella", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"intencion_pago\".\"estado\" = 'abierta'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "intencion_pago_usuario_id_usuario_id_fk": { + "name": "intencion_pago_usuario_id_usuario_id_fk", + "tableFrom": "intencion_pago", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "intencion_pago_sesion_pago_id_unique": { + "name": "intencion_pago_sesion_pago_id_unique", + "nullsNotDistinct": false, + "columns": [ + "sesion_pago_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido": { + "name": "pedido", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sesion_pago_id": { + "name": "sesion_pago_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "packs": { + "name": "packs", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "pagado_en": { + "name": "pagado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "pedido_usuario": { + "name": "pedido_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pedido_usuario_id_usuario_id_fk": { + "name": "pedido_usuario_id_usuario_id_fk", + "tableFrom": "pedido", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pedido_sesion_pago_id_unique": { + "name": "pedido_sesion_pago_id_unique", + "nullsNotDistinct": false, + "columns": [ + "sesion_pago_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido_item": { + "name": "pedido_item", + "schema": "", + "columns": { + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "pedido_item_pedido_id_pedido_id_fk": { + "name": "pedido_item_pedido_id_pedido_id_fk", + "tableFrom": "pedido_item", + "tableTo": "pedido", + "columnsFrom": [ + "pedido_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pedido_item_cancion_id_cancion_id_fk": { + "name": "pedido_item_cancion_id_cancion_id_fk", + "tableFrom": "pedido_item", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "pedido_item_pedido_id_cancion_id_pk": { + "name": "pedido_item_pedido_id_cancion_id_pk", + "columns": [ + "pedido_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido_linea": { + "name": "pedido_linea", + "schema": "", + "columns": { + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "producto_id": { + "name": "producto_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cantidad": { + "name": "cantidad", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "precio_unitario_centimos": { + "name": "precio_unitario_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "modalidad": { + "name": "modalidad", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "datos": { + "name": "datos", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": { + "pedido_linea_tipo": { + "name": "pedido_linea_tipo", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pedido_linea_pedido_id_pedido_id_fk": { + "name": "pedido_linea_pedido_id_pedido_id_fk", + "tableFrom": "pedido_linea", + "tableTo": "pedido", + "columnsFrom": [ + "pedido_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pedido_linea_producto_id_producto_id_fk": { + "name": "pedido_linea_producto_id_producto_id_fk", + "tableFrom": "pedido_linea", + "tableTo": "producto", + "columnsFrom": [ + "producto_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "pedido_linea_pedido_id_codigo_pk": { + "name": "pedido_linea_pedido_id_codigo_pk", + "columns": [ + "pedido_id", + "codigo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "pedido_linea_cantidad_positiva": { + "name": "pedido_linea_cantidad_positiva", + "value": "\"pedido_linea\".\"cantidad\" > 0" + }, + "pedido_linea_tipo_conocido": { + "name": "pedido_linea_tipo_conocido", + "value": "\"pedido_linea\".\"tipo\" in ('pack_canciones', 'libro', 'partitura', 'midi', 'stems', 'servicio', 'suscripcion')" + }, + "pedido_linea_modalidad_conocida": { + "name": "pedido_linea_modalidad_conocida", + "value": "\"pedido_linea\".\"modalidad\" in ('pago_unico', 'suscripcion')" + }, + "pedido_linea_importes_validos": { + "name": "pedido_linea_importes_validos", + "value": "\"pedido_linea\".\"precio_unitario_centimos\" >= 0 and \"pedido_linea\".\"total_centimos\" = \"pedido_linea\".\"precio_unitario_centimos\" * \"pedido_linea\".\"cantidad\"" + }, + "pedido_linea_moneda_iso": { + "name": "pedido_linea_moneda_iso", + "value": "\"pedido_linea\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "pedido_linea_datos_objeto": { + "name": "pedido_linea_datos_objeto", + "value": "jsonb_typeof(\"pedido_linea\".\"datos\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.producto": { + "name": "producto", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "precio_centimos": { + "name": "precio_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "metadatos": { + "name": "metadatos", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "producto_tipo_estado": { + "name": "producto_tipo_estado", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "producto_codigo_unique": { + "name": "producto_codigo_unique", + "nullsNotDistinct": false, + "columns": [ + "codigo" + ] + } + }, + "policies": {}, + "checkConstraints": { + "producto_tipo_conocido": { + "name": "producto_tipo_conocido", + "value": "\"producto\".\"tipo\" in ('libro', 'partitura', 'midi', 'stems', 'servicio')" + }, + "producto_estado_conocido": { + "name": "producto_estado_conocido", + "value": "\"producto\".\"estado\" in ('borrador', 'disponible', 'retirado')" + }, + "producto_precio_no_negativo": { + "name": "producto_precio_no_negativo", + "value": "\"producto\".\"precio_centimos\" >= 0" + }, + "producto_moneda_iso": { + "name": "producto_moneda_iso", + "value": "\"producto\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "producto_codigo_no_vacio": { + "name": "producto_codigo_no_vacio", + "value": "btrim(\"producto\".\"codigo\") <> ''" + }, + "producto_nombre_no_vacio": { + "name": "producto_nombre_no_vacio", + "value": "btrim(\"producto\".\"nombre\") <> ''" + }, + "producto_metadatos_objeto": { + "name": "producto_metadatos_objeto", + "value": "jsonb_typeof(\"producto\".\"metadatos\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.acceso_cancion_usuario": { + "name": "acceso_cancion_usuario", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "concedido_en": { + "name": "concedido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "acceso_cancion_usuario_cancion": { + "name": "acceso_cancion_usuario_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "acceso_cancion_usuario_usuario_id_usuario_id_fk": { + "name": "acceso_cancion_usuario_usuario_id_usuario_id_fk", + "tableFrom": "acceso_cancion_usuario", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "acceso_cancion_usuario_cancion_id_cancion_id_fk": { + "name": "acceso_cancion_usuario_cancion_id_cancion_id_fk", + "tableFrom": "acceso_cancion_usuario", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "acceso_cancion_usuario_usuario_id_cancion_id_pk": { + "name": "acceso_cancion_usuario_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.favorito": { + "name": "favorito", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "marcado_en": { + "name": "marcado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_favorito_usuario": { + "name": "idx_favorito_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "favorito_usuario_id_usuario_id_fk": { + "name": "favorito_usuario_id_usuario_id_fk", + "tableFrom": "favorito", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "favorito_cancion_id_cancion_id_fk": { + "name": "favorito_cancion_id_cancion_id_fk", + "tableFrom": "favorito", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "favorito_usuario_id_cancion_id_pk": { + "name": "favorito_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lista_reproduccion": { + "name": "lista_reproduccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lista_reproduccion_usuario": { + "name": "lista_reproduccion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lista_reproduccion_nombre_usuario": { + "name": "lista_reproduccion_nombre_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(btrim(\"nombre\"))", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "lista_reproduccion_usuario_id_usuario_id_fk": { + "name": "lista_reproduccion_usuario_id_usuario_id_fk", + "tableFrom": "lista_reproduccion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "lista_reproduccion_nombre_valido": { + "name": "lista_reproduccion_nombre_valido", + "value": "nullif(btrim(\"lista_reproduccion\".\"nombre\"), '') is not null and char_length(btrim(\"lista_reproduccion\".\"nombre\")) <= 80" + } + }, + "isRLSEnabled": false + }, + "public.lista_reproduccion_cancion": { + "name": "lista_reproduccion_cancion", + "schema": "", + "columns": { + "lista_id": { + "name": "lista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "anadida_en": { + "name": "anadida_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lista_reproduccion_orden_unico": { + "name": "lista_reproduccion_orden_unico", + "columns": [ + { + "expression": "lista_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lista_reproduccion_cancion_tema": { + "name": "lista_reproduccion_cancion_tema", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "lista_reproduccion_cancion_lista_id_lista_reproduccion_id_fk": { + "name": "lista_reproduccion_cancion_lista_id_lista_reproduccion_id_fk", + "tableFrom": "lista_reproduccion_cancion", + "tableTo": "lista_reproduccion", + "columnsFrom": [ + "lista_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "lista_reproduccion_cancion_cancion_id_cancion_id_fk": { + "name": "lista_reproduccion_cancion_cancion_id_cancion_id_fk", + "tableFrom": "lista_reproduccion_cancion", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "lista_reproduccion_cancion_lista_id_cancion_id_pk": { + "name": "lista_reproduccion_cancion_lista_id_cancion_id_pk", + "columns": [ + "lista_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "lista_reproduccion_orden_positivo": { + "name": "lista_reproduccion_orden_positivo", + "value": "\"lista_reproduccion_cancion\".\"orden\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.reproduccion": { + "name": "reproduccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "segundos": { + "name": "segundos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "dia": { + "name": "dia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "reproduccion_dia": { + "name": "reproduccion_dia", + "columns": [ + { + "expression": "dia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "reproduccion_cancion": { + "name": "reproduccion_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "reproduccion_usuario": { + "name": "reproduccion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "reproduccion_cancion_id_cancion_id_fk": { + "name": "reproduccion_cancion_id_cancion_id_fk", + "tableFrom": "reproduccion", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "reproduccion_usuario_id_usuario_id_fk": { + "name": "reproduccion_usuario_id_usuario_id_fk", + "tableFrom": "reproduccion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.valoracion": { + "name": "valoracion", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "puntuacion": { + "name": "puntuacion", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_valoracion_cancion": { + "name": "idx_valoracion_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "valoracion_usuario_id_usuario_id_fk": { + "name": "valoracion_usuario_id_usuario_id_fk", + "tableFrom": "valoracion", + "tableTo": "usuario", + "columnsFrom": [ + "usuario_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "valoracion_cancion_id_cancion_id_fk": { + "name": "valoracion_cancion_id_cancion_id_fk", + "tableFrom": "valoracion", + "tableTo": "cancion", + "columnsFrom": [ + "cancion_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "valoracion_usuario_id_cancion_id_pk": { + "name": "valoracion_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.acceso_cancion": { + "name": "acceso_cancion", + "schema": "public", + "values": [ + "ninguna", + "publico", + "exclusiva", + "privada" + ] + }, + "public.formacion_vocal": { + "name": "formacion_vocal", + "schema": "public", + "values": [ + "hombre", + "mujer", + "dueto-femenino", + "dueto-masculino", + "dueto-mixto", + "multiple-mixto", + "multiple-femenino", + "multiple-masculino" + ] + } + }, + "schemas": {}, + "sequences": { + "public.artista_codigo_seq": { + "name": "artista_codigo_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + }, + "public.artista_virtual_codigo_seq": { + "name": "artista_virtual_codigo_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + }, + "public.cancion_codigo_seq": { + "name": "cancion_codigo_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0034_snapshot.json b/drizzle/meta/0034_snapshot.json new file mode 100644 index 0000000..49d4207 --- /dev/null +++ b/drizzle/meta/0034_snapshot.json @@ -0,0 +1,8350 @@ +{ + "id": "e7e68819-6b6c-42ac-9057-0d19fa7449de", + "prevId": "52430917-b431-4a34-99f8-5da72c557bf4", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.medio": { + "name": "medio", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "clase": { + "name": "clase", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "clave": { + "name": "clave", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "publico": { + "name": "publico", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "mime": { + "name": "mime", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bytes": { + "name": "bytes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "duracion_s": { + "name": "duracion_s", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ancho": { + "name": "ancho", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "alto": { + "name": "alto", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "medio_clase": { + "name": "medio_clase", + "columns": [ + { + "expression": "clase", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "medio_sha": { + "name": "medio_sha", + "columns": [ + { + "expression": "sha256", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "medio_clave_unique": { + "name": "medio_clave_unique", + "columns": [ + "clave" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pais": { + "name": "pais", + "schema": "", + "columns": { + "codigo": { + "name": "codigo", + "type": "char(2)", + "primaryKey": true, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gentilicio": { + "name": "gentilicio", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "region": { + "name": "region", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.persona": { + "name": "persona", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_legal": { + "name": "nombre_legal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ipi": { + "name": "ipi", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nacimiento": { + "name": "nacimiento", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "defuncion": { + "name": "defuncion", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "retrato_id": { + "name": "retrato_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "semblanza": { + "name": "semblanza", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "persona_nombre": { + "name": "persona_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "persona_pais": { + "name": "persona_pais", + "columns": [ + { + "expression": "pais_codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "persona_pais_codigo_pais_codigo_fk": { + "name": "persona_pais_codigo_pais_codigo_fk", + "tableFrom": "persona", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "persona_retrato_id_medio_id_fk": { + "name": "persona_retrato_id_medio_id_fk", + "tableFrom": "persona", + "columnsFrom": [ + "retrato_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "persona_slug_unique": { + "name": "persona_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artista": { + "name": "artista", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ART-' || lpad(nextval('artista_codigo_seq')::text, 6, '0')" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persona'" + }, + "es_virtual": { + "name": "es_virtual", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre_visual": { + "name": "nombre_visual", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'texto'" + }, + "descripcion_corta": { + "name": "descripcion_corta", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "biografia": { + "name": "biografia", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_id": { + "name": "logotipo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_claro_id": { + "name": "logotipo_claro_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logotipo_oscuro_id": { + "name": "logotipo_oscuro_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "lugar_origen": { + "name": "lugar_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inicio": { + "name": "inicio", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "fin": { + "name": "fin", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sitio_web": { + "name": "sitio_web", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "artista_codigo_unico": { + "name": "artista_codigo_unico", + "columns": [ + { + "expression": "codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "artista_slug_unico": { + "name": "artista_slug_unico", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "artista_nombre": { + "name": "artista_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "artista_estado": { + "name": "artista_estado", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "artista_imagen_id_medio_id_fk": { + "name": "artista_imagen_id_medio_id_fk", + "tableFrom": "artista", + "columnsFrom": [ + "imagen_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "artista_logotipo_id_medio_id_fk": { + "name": "artista_logotipo_id_medio_id_fk", + "tableFrom": "artista", + "columnsFrom": [ + "logotipo_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "artista_logotipo_claro_id_medio_id_fk": { + "name": "artista_logotipo_claro_id_medio_id_fk", + "tableFrom": "artista", + "columnsFrom": [ + "logotipo_claro_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "artista_logotipo_oscuro_id_medio_id_fk": { + "name": "artista_logotipo_oscuro_id_medio_id_fk", + "tableFrom": "artista", + "columnsFrom": [ + "logotipo_oscuro_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "artista_pais_codigo_pais_codigo_fk": { + "name": "artista_pais_codigo_pais_codigo_fk", + "tableFrom": "artista", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "artista_tipo_conocido": { + "name": "artista_tipo_conocido", + "value": "\"artista\".\"tipo\" in ('persona', 'grupo', 'proyecto', 'virtual')" + }, + "artista_nombre_visual_conocido": { + "name": "artista_nombre_visual_conocido", + "value": "\"artista\".\"nombre_visual\" in ('texto', 'logotipo')" + }, + "artista_estado_conocido": { + "name": "artista_estado_conocido", + "value": "\"artista\".\"estado\" in ('borrador', 'publicado', 'retirado')" + }, + "artista_secciones_array": { + "name": "artista_secciones_array", + "value": "jsonb_typeof(\"artista\".\"secciones\") = 'array'" + }, + "artista_presentacion_objeto": { + "name": "artista_presentacion_objeto", + "value": "jsonb_typeof(\"artista\".\"presentacion\") = 'object'" + }, + "artista_periodo_valido": { + "name": "artista_periodo_valido", + "value": "\"artista\".\"fin\" is null or \"artista\".\"inicio\" is null or \"artista\".\"fin\" >= \"artista\".\"inicio\"" + } + }, + "isRLSEnabled": false + }, + "public.artista_identificador": { + "name": "artista_identificador", + "schema": "", + "columns": { + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sistema": { + "name": "sistema", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "valor": { + "name": "valor", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "artista_identificador_externo_unico": { + "name": "artista_identificador_externo_unico", + "columns": [ + { + "expression": "sistema", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "valor", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "artista_identificador_artista_id_artista_id_fk": { + "name": "artista_identificador_artista_id_artista_id_fk", + "tableFrom": "artista_identificador", + "columnsFrom": [ + "artista_id" + ], + "tableTo": "artista", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "artista_identificador_artista_id_sistema_pk": { + "name": "artista_identificador_artista_id_sistema_pk", + "columns": [ + "artista_id", + "sistema" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artista_persona": { + "name": "artista_persona", + "schema": "", + "columns": { + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "relacion": { + "name": "relacion", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "desde": { + "name": "desde", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "hasta": { + "name": "hasta", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "artista_persona_persona": { + "name": "artista_persona_persona", + "columns": [ + { + "expression": "persona_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "artista_persona_artista_id_artista_id_fk": { + "name": "artista_persona_artista_id_artista_id_fk", + "tableFrom": "artista_persona", + "columnsFrom": [ + "artista_id" + ], + "tableTo": "artista", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "artista_persona_persona_id_persona_id_fk": { + "name": "artista_persona_persona_id_persona_id_fk", + "tableFrom": "artista_persona", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "artista_persona_artista_id_persona_id_relacion_pk": { + "name": "artista_persona_artista_id_persona_id_relacion_pk", + "columns": [ + "artista_id", + "persona_id", + "relacion" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "artista_persona_periodo_valido": { + "name": "artista_persona_periodo_valido", + "value": "\"artista_persona\".\"hasta\" is null or \"artista_persona\".\"desde\" is null or \"artista_persona\".\"hasta\" >= \"artista_persona\".\"desde\"" + } + }, + "isRLSEnabled": false + }, + "public.album": { + "name": "album", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estilo_id": { + "name": "estilo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'album'" + }, + "fecha": { + "name": "fecha", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "portada_id": { + "name": "portada_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sello": { + "name": "sello", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "destacado": { + "name": "destacado", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "numero_catalogo": { + "name": "numero_catalogo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "formatos": { + "name": "formatos", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "pais_edicion_codigo": { + "name": "pais_edicion_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "album_estilo": { + "name": "album_estilo", + "columns": [ + { + "expression": "estilo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "album_fecha": { + "name": "album_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "album_estilo_id_estilo_id_fk": { + "name": "album_estilo_id_estilo_id_fk", + "tableFrom": "album", + "columnsFrom": [ + "estilo_id" + ], + "tableTo": "estilo", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "album_portada_id_medio_id_fk": { + "name": "album_portada_id_medio_id_fk", + "tableFrom": "album", + "columnsFrom": [ + "portada_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "album_pais_edicion_codigo_pais_codigo_fk": { + "name": "album_pais_edicion_codigo_pais_codigo_fk", + "tableFrom": "album", + "columnsFrom": [ + "pais_edicion_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "album_slug_unique": { + "name": "album_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": { + "album_secciones_array": { + "name": "album_secciones_array", + "value": "jsonb_typeof(\"album\".\"secciones\") = 'array'" + }, + "album_presentacion_objeto": { + "name": "album_presentacion_objeto", + "value": "jsonb_typeof(\"album\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.album_enlace": { + "name": "album_enlace", + "schema": "", + "columns": { + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "album_enlace_album_id_album_id_fk": { + "name": "album_enlace_album_id_album_id_fk", + "tableFrom": "album_enlace", + "columnsFrom": [ + "album_id" + ], + "tableTo": "album", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "album_enlace_album_id_plataforma_pk": { + "name": "album_enlace_album_id_plataforma_pk", + "columns": [ + "album_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.autoria": { + "name": "autoria", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "porcentaje": { + "name": "porcentaje", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "autoria_cancion_id_cancion_id_fk": { + "name": "autoria_cancion_id_cancion_id_fk", + "tableFrom": "autoria", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "autoria_persona_id_persona_id_fk": { + "name": "autoria_persona_id_persona_id_fk", + "tableFrom": "autoria", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "autoria_cancion_id_persona_id_rol_pk": { + "name": "autoria_cancion_id_persona_id_rol_pk", + "columns": [ + "cancion_id", + "persona_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion": { + "name": "cancion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'CAN-' || lpad(nextval('cancion_codigo_seq')::text, 6, '0')" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_de_id": { + "name": "version_de_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_nombre": { + "name": "version_nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_nota": { + "name": "version_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_codigo": { + "name": "version_codigo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version_orden": { + "name": "version_orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "estilo_id": { + "name": "estilo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duracion_s": { + "name": "duracion_s", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ano": { + "name": "ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "letra": { + "name": "letra", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inspiracion": { + "name": "inspiracion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inspiracion_secciones": { + "name": "inspiracion_secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "tiene_letra": { + "name": "tiene_letra", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "formacion_vocal": { + "name": "formacion_vocal", + "type": "formacion_vocal", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "acceso": { + "name": "acceso", + "type": "acceso_cancion", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'publico'" + }, + "destacada": { + "name": "destacada", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "portada_id": { + "name": "portada_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ala_venta": { + "name": "ala_venta", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "cancion_codigo_unico": { + "name": "cancion_codigo_unico", + "columns": [ + { + "expression": "codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_estilo": { + "name": "cancion_estilo", + "columns": [ + { + "expression": "estilo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_album": { + "name": "cancion_album", + "columns": [ + { + "expression": "album_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_version_de": { + "name": "cancion_version_de", + "columns": [ + { + "expression": "version_de_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_destacada": { + "name": "cancion_destacada", + "columns": [ + { + "expression": "destacada", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_version_codigo_unico": { + "name": "cancion_version_codigo_unico", + "columns": [ + { + "expression": "version_de_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_codigo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"cancion\".\"version_de_id\" is not null", + "concurrently": false + } + }, + "foreignKeys": { + "cancion_estilo_id_estilo_id_fk": { + "name": "cancion_estilo_id_estilo_id_fk", + "tableFrom": "cancion", + "columnsFrom": [ + "estilo_id" + ], + "tableTo": "estilo", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "cancion_album_id_album_id_fk": { + "name": "cancion_album_id_album_id_fk", + "tableFrom": "cancion", + "columnsFrom": [ + "album_id" + ], + "tableTo": "album", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "cancion_portada_id_medio_id_fk": { + "name": "cancion_portada_id_medio_id_fk", + "tableFrom": "cancion", + "columnsFrom": [ + "portada_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "cancion_slug_unique": { + "name": "cancion_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": { + "cancion_version_codigo_presente": { + "name": "cancion_version_codigo_presente", + "value": "(\"cancion\".\"version_de_id\" is null and \"cancion\".\"version_codigo\" is null) or (\"cancion\".\"version_de_id\" is not null and nullif(btrim(\"cancion\".\"version_codigo\"), '') is not null)" + }, + "cancion_version_no_se_vende": { + "name": "cancion_version_no_se_vende", + "value": "\"cancion\".\"version_de_id\" is null or not \"cancion\".\"ala_venta\"" + }, + "cancion_idioma_bcp47": { + "name": "cancion_idioma_bcp47", + "value": "\"cancion\".\"idioma\" ~ '^[a-z]{2,8}(-[A-Za-z0-9]{1,8})*$'" + }, + "cancion_estado_conocido": { + "name": "cancion_estado_conocido", + "value": "\"cancion\".\"estado\" in ('borrador', 'publicado', 'retirado')" + }, + "cancion_inspiracion_secciones_array": { + "name": "cancion_inspiracion_secciones_array", + "value": "jsonb_typeof(\"cancion\".\"inspiracion_secciones\") = 'array'" + }, + "cancion_presentacion_objeto": { + "name": "cancion_presentacion_objeto", + "value": "jsonb_typeof(\"cancion\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.cancion_audio": { + "name": "cancion_audio", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "medio_id": { + "name": "medio_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uso": { + "name": "uso", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "formato": { + "name": "formato", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bitrate_kbps": { + "name": "bitrate_kbps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "frecuencia_hz": { + "name": "frecuencia_hz", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bits_muestra": { + "name": "bits_muestra", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "canales": { + "name": "canales", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "cancion_audio_medio_unico": { + "name": "cancion_audio_medio_unico", + "columns": [ + { + "expression": "medio_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "cancion_audio_cancion": { + "name": "cancion_audio_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "cancion_audio_cancion_id_cancion_id_fk": { + "name": "cancion_audio_cancion_id_cancion_id_fk", + "tableFrom": "cancion_audio", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "cancion_audio_medio_id_medio_id_fk": { + "name": "cancion_audio_medio_id_medio_id_fk", + "tableFrom": "cancion_audio", + "columnsFrom": [ + "medio_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": { + "cancion_audio_cancion_id_uso_formato_pk": { + "name": "cancion_audio_cancion_id_uso_formato_pk", + "columns": [ + "cancion_id", + "uso", + "formato" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "cancion_audio_uso_conocido": { + "name": "cancion_audio_uso_conocido", + "value": "\"cancion_audio\".\"uso\" in ('stream', 'descarga', 'master')" + }, + "cancion_audio_bitrate_valido": { + "name": "cancion_audio_bitrate_valido", + "value": "\"cancion_audio\".\"bitrate_kbps\" is null or \"cancion_audio\".\"bitrate_kbps\" > 0" + }, + "cancion_audio_frecuencia_valida": { + "name": "cancion_audio_frecuencia_valida", + "value": "\"cancion_audio\".\"frecuencia_hz\" is null or \"cancion_audio\".\"frecuencia_hz\" > 0" + }, + "cancion_audio_bits_validos": { + "name": "cancion_audio_bits_validos", + "value": "\"cancion_audio\".\"bits_muestra\" is null or \"cancion_audio\".\"bits_muestra\" > 0" + }, + "cancion_audio_canales_validos": { + "name": "cancion_audio_canales_validos", + "value": "\"cancion_audio\".\"canales\" is null or \"cancion_audio\".\"canales\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.cancion_enlace": { + "name": "cancion_enlace", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_enlace_cancion_id_cancion_id_fk": { + "name": "cancion_enlace_cancion_id_cancion_id_fk", + "tableFrom": "cancion_enlace", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "cancion_enlace_cancion_id_plataforma_pk": { + "name": "cancion_enlace_cancion_id_plataforma_pk", + "columns": [ + "cancion_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_etiqueta": { + "name": "cancion_etiqueta", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_etiqueta_cancion_id_cancion_id_fk": { + "name": "cancion_etiqueta_cancion_id_cancion_id_fk", + "tableFrom": "cancion_etiqueta", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "cancion_etiqueta_etiqueta_id_etiqueta_id_fk": { + "name": "cancion_etiqueta_etiqueta_id_etiqueta_id_fk", + "tableFrom": "cancion_etiqueta", + "columnsFrom": [ + "etiqueta_id" + ], + "tableTo": "etiqueta", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "cancion_etiqueta_cancion_id_etiqueta_id_pk": { + "name": "cancion_etiqueta_cancion_id_etiqueta_id_pk", + "columns": [ + "cancion_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_interprete": { + "name": "cancion_interprete", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "artista_id": { + "name": "artista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'principal'" + }, + "instrumento": { + "name": "instrumento", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acreditado_como": { + "name": "acreditado_como", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "cancion_interprete_artista": { + "name": "cancion_interprete_artista", + "columns": [ + { + "expression": "artista_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "cancion_interprete_cancion_id_cancion_id_fk": { + "name": "cancion_interprete_cancion_id_cancion_id_fk", + "tableFrom": "cancion_interprete", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "cancion_interprete_artista_id_artista_id_fk": { + "name": "cancion_interprete_artista_id_artista_id_fk", + "tableFrom": "cancion_interprete", + "columnsFrom": [ + "artista_id" + ], + "tableTo": "artista", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_interprete_cancion_id_artista_id_rol_pk": { + "name": "cancion_interprete_cancion_id_artista_id_rol_pk", + "columns": [ + "cancion_id", + "artista_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "cancion_interprete_rol_conocido": { + "name": "cancion_interprete_rol_conocido", + "value": "\"cancion_interprete\".\"rol\" in ('principal', 'invitado', 'coros', 'instrumentista')" + } + }, + "isRLSEnabled": false + }, + "public.cancion_persona": { + "name": "cancion_persona", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_persona_cancion_id_cancion_id_fk": { + "name": "cancion_persona_cancion_id_cancion_id_fk", + "tableFrom": "cancion_persona", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "cancion_persona_persona_id_persona_id_fk": { + "name": "cancion_persona_persona_id_persona_id_fk", + "tableFrom": "cancion_persona", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "cancion_persona_cancion_id_persona_id_rol_pk": { + "name": "cancion_persona_cancion_id_persona_id_rol_pk", + "columns": [ + "cancion_id", + "persona_id", + "rol" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credito_album": { + "name": "credito_album", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "credito_album_album": { + "name": "credito_album_album", + "columns": [ + { + "expression": "album_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "credito_album_album_id_album_id_fk": { + "name": "credito_album_album_id_album_id_fk", + "tableFrom": "credito_album", + "columnsFrom": [ + "album_id" + ], + "tableTo": "album", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "credito_album_persona_id_persona_id_fk": { + "name": "credito_album_persona_id_persona_id_fk", + "tableFrom": "credito_album", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.estilo": { + "name": "estilo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "estilo_principal_unico": { + "name": "estilo_principal_unico", + "columns": [ + { + "expression": "principal", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"estilo\".\"principal\"", + "concurrently": false + }, + "estilo_orden": { + "name": "estilo_orden", + "columns": [ + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "estilo_imagen_id_medio_id_fk": { + "name": "estilo_imagen_id_medio_id_fk", + "tableFrom": "estilo", + "columnsFrom": [ + "imagen_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "estilo_slug_unique": { + "name": "estilo_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.etiqueta": { + "name": "etiqueta", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "etiqueta_slug_unique": { + "name": "etiqueta_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.registro_obra": { + "name": "registro_obra", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "iswc": { + "name": "iswc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isrc": { + "name": "isrc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "entidad": { + "name": "entidad", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numero": { + "name": "numero", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "editorial": { + "name": "editorial", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "registro_obra_cancion_id_cancion_id_fk": { + "name": "registro_obra_cancion_id_cancion_id_fk", + "tableFrom": "registro_obra", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.traduccion": { + "name": "traduccion", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "traduccion_cancion_id_cancion_id_fk": { + "name": "traduccion_cancion_id_cancion_id_fk", + "tableFrom": "traduccion", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "traduccion_cancion_id_idioma_pk": { + "name": "traduccion_cancion_id_idioma_pk", + "columns": [ + "cancion_id", + "idioma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.video": { + "name": "video", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "youtube_id": { + "name": "youtube_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "video_cancion": { + "name": "video_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "video_cancion_id_cancion_id_fk": { + "name": "video_cancion_id_cancion_id_fk", + "tableFrom": "video", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.acepcion": { + "name": "acepcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "categoria": { + "name": "categoria", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "definicion": { + "name": "definicion", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ampliacion": { + "name": "ampliacion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ejemplo": { + "name": "ejemplo", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "acepcion_numero": { + "name": "acepcion_numero", + "columns": [ + { + "expression": "termino_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "numero", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "acepcion_termino_id_termino_id_fk": { + "name": "acepcion_termino_id_termino_id_fk", + "tableFrom": "acepcion", + "columnsFrom": [ + "termino_id" + ], + "tableTo": "termino", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.animo": { + "name": "animo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gems": { + "name": "gems", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valencia": { + "name": "valencia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "energia": { + "name": "energia", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "animo_codigo_unique": { + "name": "animo_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.cancion_genero": { + "name": "cancion_genero", + "schema": "", + "columns": { + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "cancion_genero_cancion_id_cancion_id_fk": { + "name": "cancion_genero_cancion_id_cancion_id_fk", + "tableFrom": "cancion_genero", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "cancion_genero_genero_id_genero_id_fk": { + "name": "cancion_genero_genero_id_genero_id_fk", + "tableFrom": "cancion_genero", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "cancion_genero_cancion_id_genero_id_pk": { + "name": "cancion_genero_cancion_id_genero_id_pk", + "columns": [ + "cancion_id", + "genero_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.capitulo": { + "name": "capitulo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "capitulo_tipo": { + "name": "capitulo_tipo", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "capitulo_genero_id_genero_id_fk": { + "name": "capitulo_genero_id_genero_id_fk", + "tableFrom": "capitulo", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "capitulo_slug_unique": { + "name": "capitulo_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.capitulo_acepcion": { + "name": "capitulo_acepcion", + "schema": "", + "columns": { + "capitulo_id": { + "name": "capitulo_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "acepcion_id": { + "name": "acepcion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "automatico": { + "name": "automatico", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "confirmado": { + "name": "confirmado", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "capitulo_acepcion_capitulo_id_capitulo_id_fk": { + "name": "capitulo_acepcion_capitulo_id_capitulo_id_fk", + "tableFrom": "capitulo_acepcion", + "columnsFrom": [ + "capitulo_id" + ], + "tableTo": "capitulo", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "capitulo_acepcion_acepcion_id_acepcion_id_fk": { + "name": "capitulo_acepcion_acepcion_id_acepcion_id_fk", + "tableFrom": "capitulo_acepcion", + "columnsFrom": [ + "acepcion_id" + ], + "tableTo": "acepcion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "capitulo_acepcion_capitulo_id_acepcion_id_pk": { + "name": "capitulo_acepcion_capitulo_id_acepcion_id_pk", + "columns": [ + "capitulo_id", + "acepcion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.compas": { + "name": "compas", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "numerador": { + "name": "numerador", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "denominador": { + "name": "denominador", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "compas_codigo_unique": { + "name": "compas_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero": { + "name": "genero", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "origen_lugar": { + "name": "origen_lugar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "origen_ano": { + "name": "origen_ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tempo": { + "name": "tempo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metrica_nota": { + "name": "metrica_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "compas_nota": { + "name": "compas_nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rasgos": { + "name": "rasgos", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "genero_nombre": { + "name": "genero_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "genero_origen_ano": { + "name": "genero_origen_ano", + "columns": [ + { + "expression": "origen_ano", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "genero_slug_unique": { + "name": "genero_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_alias": { + "name": "genero_alias", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "genero_alias_nombre": { + "name": "genero_alias_nombre", + "columns": [ + { + "expression": "nombre", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "genero_alias_genero_id_genero_id_fk": { + "name": "genero_alias_genero_id_genero_id_fk", + "tableFrom": "genero_alias", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_alias_pais_codigo_pais_codigo_fk": { + "name": "genero_alias_pais_codigo_pais_codigo_fk", + "tableFrom": "genero_alias", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_compas": { + "name": "genero_compas", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "compas_id": { + "name": "compas_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_compas_genero_id_genero_id_fk": { + "name": "genero_compas_genero_id_genero_id_fk", + "tableFrom": "genero_compas", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_compas_compas_id_compas_id_fk": { + "name": "genero_compas_compas_id_compas_id_fk", + "tableFrom": "genero_compas", + "columnsFrom": [ + "compas_id" + ], + "tableTo": "compas", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "genero_compas_genero_id_compas_id_pk": { + "name": "genero_compas_genero_id_compas_id_pk", + "columns": [ + "genero_id", + "compas_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_instrumento": { + "name": "genero_instrumento", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instrumento_id": { + "name": "instrumento_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "importancia": { + "name": "importancia", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'habitual'" + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_instrumento_genero_id_genero_id_fk": { + "name": "genero_instrumento_genero_id_genero_id_fk", + "tableFrom": "genero_instrumento", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_instrumento_instrumento_id_instrumento_id_fk": { + "name": "genero_instrumento_instrumento_id_instrumento_id_fk", + "tableFrom": "genero_instrumento", + "columnsFrom": [ + "instrumento_id" + ], + "tableTo": "instrumento", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "genero_instrumento_genero_id_instrumento_id_pk": { + "name": "genero_instrumento_genero_id_instrumento_id_pk", + "columns": [ + "genero_id", + "instrumento_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_metro": { + "name": "genero_metro", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metro_id": { + "name": "metro_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "predominante": { + "name": "predominante", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_metro_genero_id_genero_id_fk": { + "name": "genero_metro_genero_id_genero_id_fk", + "tableFrom": "genero_metro", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_metro_metro_id_metro_id_fk": { + "name": "genero_metro_metro_id_metro_id_fk", + "tableFrom": "genero_metro", + "columnsFrom": [ + "metro_id" + ], + "tableTo": "metro", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "genero_metro_genero_id_metro_id_pk": { + "name": "genero_metro_genero_id_metro_id_pk", + "columns": [ + "genero_id", + "metro_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_origen": { + "name": "genero_origen", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "origen_id": { + "name": "origen_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "principal": { + "name": "principal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "genero_origen_origen": { + "name": "genero_origen_origen", + "columns": [ + { + "expression": "origen_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "genero_origen_genero_id_genero_id_fk": { + "name": "genero_origen_genero_id_genero_id_fk", + "tableFrom": "genero_origen", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_origen_origen_id_genero_id_fk": { + "name": "genero_origen_origen_id_genero_id_fk", + "tableFrom": "genero_origen", + "columnsFrom": [ + "origen_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "genero_origen_genero_id_origen_id_tipo_pk": { + "name": "genero_origen_genero_id_origen_id_tipo_pk", + "columns": [ + "genero_id", + "origen_id", + "tipo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_pais": { + "name": "genero_pais", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + }, + "relacion": { + "name": "relacion", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'adoptado'" + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "genero_pais_genero_id_genero_id_fk": { + "name": "genero_pais_genero_id_genero_id_fk", + "tableFrom": "genero_pais", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_pais_pais_codigo_pais_codigo_fk": { + "name": "genero_pais_pais_codigo_pais_codigo_fk", + "tableFrom": "genero_pais", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "genero_pais_genero_id_pais_codigo_pk": { + "name": "genero_pais_genero_id_pais_codigo_pk", + "columns": [ + "genero_id", + "pais_codigo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_persona": { + "name": "genero_persona", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_persona_genero_id_genero_id_fk": { + "name": "genero_persona_genero_id_genero_id_fk", + "tableFrom": "genero_persona", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_persona_persona_id_persona_id_fk": { + "name": "genero_persona_persona_id_persona_id_fk", + "tableFrom": "genero_persona", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "genero_persona_genero_id_persona_id_papel_pk": { + "name": "genero_persona_genero_id_persona_id_papel_pk", + "columns": [ + "genero_id", + "persona_id", + "papel" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_seccion": { + "name": "genero_seccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "clave": { + "name": "clave", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "genero_seccion_clave": { + "name": "genero_seccion_clave", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "clave", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "genero_seccion_genero_id_genero_id_fk": { + "name": "genero_seccion_genero_id_genero_id_fk", + "tableFrom": "genero_seccion", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.genero_tema": { + "name": "genero_tema", + "schema": "", + "columns": { + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "genero_tema_genero_id_genero_id_fk": { + "name": "genero_tema_genero_id_genero_id_fk", + "tableFrom": "genero_tema", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "genero_tema_etiqueta_id_etiqueta_id_fk": { + "name": "genero_tema_etiqueta_id_etiqueta_id_fk", + "tableFrom": "genero_tema", + "columnsFrom": [ + "etiqueta_id" + ], + "tableTo": "etiqueta", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "genero_tema_genero_id_etiqueta_id_pk": { + "name": "genero_tema_genero_id_etiqueta_id_pk", + "columns": [ + "genero_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.instrumento": { + "name": "instrumento", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "familia": { + "name": "familia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subfamilia": { + "name": "subfamilia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "afinacion": { + "name": "afinacion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "muestra_id": { + "name": "muestra_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "instrumento_familia": { + "name": "instrumento_familia", + "columns": [ + { + "expression": "familia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "instrumento_pais_codigo_pais_codigo_fk": { + "name": "instrumento_pais_codigo_pais_codigo_fk", + "tableFrom": "instrumento", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "instrumento_imagen_id_medio_id_fk": { + "name": "instrumento_imagen_id_medio_id_fk", + "tableFrom": "instrumento", + "columnsFrom": [ + "imagen_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "instrumento_muestra_id_medio_id_fk": { + "name": "instrumento_muestra_id_medio_id_fk", + "tableFrom": "instrumento", + "columnsFrom": [ + "muestra_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "instrumento_slug_unique": { + "name": "instrumento_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.metro": { + "name": "metro", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "silabas": { + "name": "silabas", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "metro_codigo_unique": { + "name": "metro_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.modelo_ia": { + "name": "modelo_ia", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "familia": { + "name": "familia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vigente": { + "name": "vigente", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "nota_sintaxis": { + "name": "nota_sintaxis", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "esquema": { + "name": "esquema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "modelo_ia_familia": { + "name": "modelo_ia_familia", + "columns": [ + { + "expression": "familia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "modelo_ia_codigo_unique": { + "name": "modelo_ia_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia": { + "name": "obra_referencia", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ano": { + "name": "ano", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nota": { + "name": "nota", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cita": { + "name": "cita", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "obra_referencia_genero": { + "name": "obra_referencia_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "obra_referencia_genero_id_genero_id_fk": { + "name": "obra_referencia_genero_id_genero_id_fk", + "tableFrom": "obra_referencia", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "obra_referencia_slug_unique": { + "name": "obra_referencia_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia_enlace": { + "name": "obra_referencia_enlace", + "schema": "", + "columns": { + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "plataforma": { + "name": "plataforma", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "obra_referencia_enlace_obra_id_obra_referencia_id_fk": { + "name": "obra_referencia_enlace_obra_id_obra_referencia_id_fk", + "tableFrom": "obra_referencia_enlace", + "columnsFrom": [ + "obra_id" + ], + "tableTo": "obra_referencia", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "obra_referencia_enlace_obra_id_plataforma_pk": { + "name": "obra_referencia_enlace_obra_id_plataforma_pk", + "columns": [ + "obra_id", + "plataforma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obra_referencia_persona": { + "name": "obra_referencia_persona", + "schema": "", + "columns": { + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "persona_id": { + "name": "persona_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "papel": { + "name": "papel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "obra_referencia_persona_obra_id_obra_referencia_id_fk": { + "name": "obra_referencia_persona_obra_id_obra_referencia_id_fk", + "tableFrom": "obra_referencia_persona", + "columnsFrom": [ + "obra_id" + ], + "tableTo": "obra_referencia", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "obra_referencia_persona_persona_id_persona_id_fk": { + "name": "obra_referencia_persona_persona_id_persona_id_fk", + "tableFrom": "obra_referencia_persona", + "columnsFrom": [ + "persona_id" + ], + "tableTo": "persona", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": { + "obra_referencia_persona_obra_id_persona_id_papel_pk": { + "name": "obra_referencia_persona_obra_id_persona_id_papel_pk", + "columns": [ + "obra_id", + "persona_id", + "papel" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.prompt": { + "name": "prompt", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "modelo_ia_id": { + "name": "modelo_ia_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "animo_id": { + "name": "animo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idioma": { + "name": "idioma", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'en'" + }, + "contenido": { + "name": "contenido", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "notas": { + "name": "notas", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valoracion": { + "name": "valoracion", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "ejemplo_id": { + "name": "ejemplo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preferido": { + "name": "preferido", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "visibilidad": { + "name": "visibilidad", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'privado'" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "prompt_genero": { + "name": "prompt_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "prompt_cancion": { + "name": "prompt_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "prompt_modelo": { + "name": "prompt_modelo", + "columns": [ + { + "expression": "modelo_ia_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "prompt_animo": { + "name": "prompt_animo", + "columns": [ + { + "expression": "animo_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "prompt_modelo_ia_id_modelo_ia_id_fk": { + "name": "prompt_modelo_ia_id_modelo_ia_id_fk", + "tableFrom": "prompt", + "columnsFrom": [ + "modelo_ia_id" + ], + "tableTo": "modelo_ia", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "prompt_genero_id_genero_id_fk": { + "name": "prompt_genero_id_genero_id_fk", + "tableFrom": "prompt", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "prompt_cancion_id_cancion_id_fk": { + "name": "prompt_cancion_id_cancion_id_fk", + "tableFrom": "prompt", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "prompt_animo_id_animo_id_fk": { + "name": "prompt_animo_id_animo_id_fk", + "tableFrom": "prompt", + "columnsFrom": [ + "animo_id" + ], + "tableTo": "animo", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "prompt_ejemplo_id_medio_id_fk": { + "name": "prompt_ejemplo_id_medio_id_fk", + "tableFrom": "prompt", + "columnsFrom": [ + "ejemplo_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.termino": { + "name": "termino", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "termino": { + "name": "termino", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "termino_slug_unique": { + "name": "termino_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + }, + "termino_termino_unique": { + "name": "termino_termino_unique", + "columns": [ + "termino" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.termino_variante": { + "name": "termino_variante", + "schema": "", + "columns": { + "termino_id": { + "name": "termino_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "forma": { + "name": "forma", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "termino_variante_termino_id_termino_id_fk": { + "name": "termino_variante_termino_id_termino_id_fk", + "tableFrom": "termino_variante", + "columnsFrom": [ + "termino_id" + ], + "tableTo": "termino", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "termino_variante_termino_id_forma_pk": { + "name": "termino_variante_termino_id_forma_pk", + "columns": [ + "termino_id", + "forma" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verso": { + "name": "verso", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "genero_id": { + "name": "genero_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ilustra": { + "name": "ilustra", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fuente": { + "name": "fuente", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'ejemplo'" + }, + "analisis": { + "name": "analisis", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "medida": { + "name": "medida", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "obra_id": { + "name": "obra_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "origen": { + "name": "origen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "modelo_origen": { + "name": "modelo_origen", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importado_en": { + "name": "importado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revisado_por": { + "name": "revisado_por", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revisado_en": { + "name": "revisado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "verso_genero": { + "name": "verso_genero", + "columns": [ + { + "expression": "genero_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "verso_genero_id_genero_id_fk": { + "name": "verso_genero_id_genero_id_fk", + "tableFrom": "verso", + "columnsFrom": [ + "genero_id" + ], + "tableTo": "genero", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "verso_obra_id_obra_referencia_id_fk": { + "name": "verso_obra_id_obra_referencia_id_fk", + "tableFrom": "verso", + "columnsFrom": [ + "obra_id" + ], + "tableTo": "obra_referencia", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "verso_cancion_id_cancion_id_fk": { + "name": "verso_cancion_id_cancion_id_fk", + "tableFrom": "verso", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verso_linea": { + "name": "verso_linea", + "schema": "", + "columns": { + "verso_id": { + "name": "verso_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "texto": { + "name": "texto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "silabas": { + "name": "silabas", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "tonicas": { + "name": "tonicas", + "type": "integer[]", + "primaryKey": false, + "notNull": false + }, + "medida": { + "name": "medida", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "rima": { + "name": "rima", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "verso_linea_verso_id_verso_id_fk": { + "name": "verso_linea_verso_id_verso_id_fk", + "tableFrom": "verso_linea", + "columnsFrom": [ + "verso_id" + ], + "tableTo": "verso", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "verso_linea_verso_id_numero_pk": { + "name": "verso_linea_verso_id_numero_pk", + "columns": [ + "verso_id", + "numero" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documento_legal": { + "name": "documento_legal", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "version_vigente_id": { + "name": "version_vigente_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "documento_legal_slug_unique": { + "name": "documento_legal_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entrada": { + "name": "entrada", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fecha": { + "name": "fecha", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resumen": { + "name": "resumen", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secciones": { + "name": "secciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "presentacion": { + "name": "presentacion", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "imagen_id": { + "name": "imagen_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "entrada_fecha": { + "name": "entrada_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "entrada_imagen_id_medio_id_fk": { + "name": "entrada_imagen_id_medio_id_fk", + "tableFrom": "entrada", + "columnsFrom": [ + "imagen_id" + ], + "tableTo": "medio", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "entrada_slug_unique": { + "name": "entrada_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": { + "entrada_secciones_array": { + "name": "entrada_secciones_array", + "value": "jsonb_typeof(\"entrada\".\"secciones\") = 'array'" + }, + "entrada_presentacion_objeto": { + "name": "entrada_presentacion_objeto", + "value": "jsonb_typeof(\"entrada\".\"presentacion\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.entrada_cancion": { + "name": "entrada_cancion", + "schema": "", + "columns": { + "entrada_id": { + "name": "entrada_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "entrada_cancion_entrada_id_entrada_id_fk": { + "name": "entrada_cancion_entrada_id_entrada_id_fk", + "tableFrom": "entrada_cancion", + "columnsFrom": [ + "entrada_id" + ], + "tableTo": "entrada", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "entrada_cancion_cancion_id_cancion_id_fk": { + "name": "entrada_cancion_cancion_id_cancion_id_fk", + "tableFrom": "entrada_cancion", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "entrada_cancion_entrada_id_cancion_id_pk": { + "name": "entrada_cancion_entrada_id_cancion_id_pk", + "columns": [ + "entrada_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entrada_etiqueta": { + "name": "entrada_etiqueta", + "schema": "", + "columns": { + "entrada_id": { + "name": "entrada_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "etiqueta_id": { + "name": "etiqueta_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "entrada_etiqueta_entrada_id_entrada_id_fk": { + "name": "entrada_etiqueta_entrada_id_entrada_id_fk", + "tableFrom": "entrada_etiqueta", + "columnsFrom": [ + "entrada_id" + ], + "tableTo": "entrada", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "entrada_etiqueta_etiqueta_id_etiqueta_id_fk": { + "name": "entrada_etiqueta_etiqueta_id_etiqueta_id_fk", + "tableFrom": "entrada_etiqueta", + "columnsFrom": [ + "etiqueta_id" + ], + "tableTo": "etiqueta", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "entrada_etiqueta_entrada_id_etiqueta_id_pk": { + "name": "entrada_etiqueta_entrada_id_etiqueta_id_pk", + "columns": [ + "entrada_id", + "etiqueta_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pagina": { + "name": "pagina", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pagina_slug_unique": { + "name": "pagina_slug_unique", + "columns": [ + "slug" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.redireccion": { + "name": "redireccion", + "schema": "", + "columns": { + "desde": { + "name": "desde", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "hacia": { + "name": "hacia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permanente": { + "name": "permanente", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "motivo": { + "name": "motivo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "redireccion_hacia": { + "name": "redireccion_hacia", + "columns": [ + { + "expression": "hacia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.version_legal": { + "name": "version_legal", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "documento_id": { + "name": "documento_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cuerpo": { + "name": "cuerpo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vigente_desde": { + "name": "vigente_desde", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "resumen_cambios": { + "name": "resumen_cambios", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "version_legal_documento": { + "name": "version_legal_documento", + "columns": [ + { + "expression": "documento_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "vigente_desde", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "version_legal_documento_id_documento_legal_id_fk": { + "name": "version_legal_documento_id_documento_legal_id_fk", + "tableFrom": "version_legal", + "columnsFrom": [ + "documento_id" + ], + "tableTo": "documento_legal", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contador_factura": { + "name": "contador_factura", + "schema": "", + "columns": { + "serie": { + "name": "serie", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "ultimo_numero": { + "name": "ultimo_numero", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datos_facturacion": { + "name": "datos_facturacion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'particular'" + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nif": { + "name": "nif", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "direccion": { + "name": "direccion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cp": { + "name": "cp", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ciudad": { + "name": "ciudad", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provincia": { + "name": "provincia", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + }, + "predeterminada": { + "name": "predeterminada", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "datos_facturacion_usuario": { + "name": "datos_facturacion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "datos_facturacion_usuario_id_usuario_id_fk": { + "name": "datos_facturacion_usuario_id_usuario_id_fk", + "tableFrom": "datos_facturacion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "datos_facturacion_pais_codigo_pais_codigo_fk": { + "name": "datos_facturacion_pais_codigo_pais_codigo_fk", + "tableFrom": "datos_facturacion", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.descarga": { + "name": "descarga", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bajada_en": { + "name": "bajada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "agente": { + "name": "agente", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "descarga_usuario": { + "name": "descarga_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "descarga_fecha": { + "name": "descarga_fecha", + "columns": [ + { + "expression": "bajada_en", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "descarga_usuario_id_usuario_id_fk": { + "name": "descarga_usuario_id_usuario_id_fk", + "tableFrom": "descarga", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "descarga_cancion_id_cancion_id_fk": { + "name": "descarga_cancion_id_cancion_id_fk", + "tableFrom": "descarga", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.factura": { + "name": "factura", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "serie": { + "name": "serie", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "numero": { + "name": "numero", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'normal'" + }, + "rectifica_a_id": { + "name": "rectifica_a_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fecha": { + "name": "fecha", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "base_centimos": { + "name": "base_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "iva_tipo": { + "name": "iva_tipo", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "iva_cuota_centimos": { + "name": "iva_cuota_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "datos_congelados": { + "name": "datos_congelados", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pais_codigo": { + "name": "pais_codigo", + "type": "char(2)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "factura_serie_numero": { + "name": "factura_serie_numero", + "columns": [ + { + "expression": "serie", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "numero", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "factura_pedido": { + "name": "factura_pedido", + "columns": [ + { + "expression": "pedido_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "factura_fecha": { + "name": "factura_fecha", + "columns": [ + { + "expression": "fecha", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "factura_pedido_id_pedido_id_fk": { + "name": "factura_pedido_id_pedido_id_fk", + "tableFrom": "factura", + "columnsFrom": [ + "pedido_id" + ], + "tableTo": "pedido", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + }, + "factura_pais_codigo_pais_codigo_fk": { + "name": "factura_pais_codigo_pais_codigo_fk", + "tableFrom": "factura", + "columnsFrom": [ + "pais_codigo" + ], + "tableTo": "pais", + "columnsTo": [ + "codigo" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.codigo_acceso": { + "name": "codigo_acceso", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "intentos": { + "name": "intentos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "usado_en": { + "name": "usado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "codigo_acceso_email": { + "name": "codigo_acceso_email", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.identidad": { + "name": "identidad", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "proveedor": { + "name": "proveedor", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sujeto": { + "name": "sujeto", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ultimo_acceso_en": { + "name": "ultimo_acceso_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "identidad_proveedor_sujeto": { + "name": "identidad_proveedor_sujeto", + "columns": [ + { + "expression": "proveedor", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sujeto", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "identidad_usuario": { + "name": "identidad_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "identidad_usuario_id_usuario_id_fk": { + "name": "identidad_usuario_id_usuario_id_fk", + "tableFrom": "identidad", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.limite": { + "name": "limite", + "schema": "", + "columns": { + "clave": { + "name": "clave", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "intentos": { + "name": "intentos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "limite_expira": { + "name": "limite_expira", + "columns": [ + { + "expression": "expira_en", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plan_suscripcion": { + "name": "plan_suscripcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nivel": { + "name": "nivel", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "precio_centimos": { + "name": "precio_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "periodicidad": { + "name": "periodicidad", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intervalos": { + "name": "intervalos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "ambito": { + "name": "ambito", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'musica'" + }, + "incluye_publicidad": { + "name": "incluye_publicidad", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "calidad_escucha": { + "name": "calidad_escucha", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'media'" + }, + "descargas_incluidas": { + "name": "descargas_incluidas", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "calidad_descarga": { + "name": "calidad_descarga", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acceso_versiones": { + "name": "acceso_versiones", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "acceso_contenido_taller": { + "name": "acceso_contenido_taller", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "descarga_material_taller": { + "name": "descarga_material_taller", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "referencia_precio_externa": { + "name": "referencia_precio_externa", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prestaciones": { + "name": "prestaciones", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "plan_suscripcion_estado_nivel": { + "name": "plan_suscripcion_estado_nivel", + "columns": [ + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "nivel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "plan_suscripcion_codigo_unique": { + "name": "plan_suscripcion_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + }, + "plan_suscripcion_referencia_precio_externa_unique": { + "name": "plan_suscripcion_referencia_precio_externa_unique", + "columns": [ + "referencia_precio_externa" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": { + "plan_suscripcion_periodicidad_conocida": { + "name": "plan_suscripcion_periodicidad_conocida", + "value": "\"plan_suscripcion\".\"periodicidad\" in ('dia', 'semana', 'mes', 'ano')" + }, + "plan_suscripcion_estado_conocido": { + "name": "plan_suscripcion_estado_conocido", + "value": "\"plan_suscripcion\".\"estado\" in ('borrador', 'disponible', 'retirado')" + }, + "plan_suscripcion_nivel_positivo": { + "name": "plan_suscripcion_nivel_positivo", + "value": "\"plan_suscripcion\".\"nivel\" > 0" + }, + "plan_suscripcion_precio_no_negativo": { + "name": "plan_suscripcion_precio_no_negativo", + "value": "\"plan_suscripcion\".\"precio_centimos\" >= 0" + }, + "plan_suscripcion_intervalos_positivos": { + "name": "plan_suscripcion_intervalos_positivos", + "value": "\"plan_suscripcion\".\"intervalos\" > 0" + }, + "plan_suscripcion_ambito_conocido": { + "name": "plan_suscripcion_ambito_conocido", + "value": "\"plan_suscripcion\".\"ambito\" in ('musica', 'taller_letras')" + }, + "plan_suscripcion_calidad_escucha_conocida": { + "name": "plan_suscripcion_calidad_escucha_conocida", + "value": "\"plan_suscripcion\".\"calidad_escucha\" is null or \"plan_suscripcion\".\"calidad_escucha\" in ('media', 'alta')" + }, + "plan_suscripcion_calidad_descarga_conocida": { + "name": "plan_suscripcion_calidad_descarga_conocida", + "value": "\"plan_suscripcion\".\"calidad_descarga\" is null or \"plan_suscripcion\".\"calidad_descarga\" in ('media', 'alta')" + }, + "plan_suscripcion_descargas_no_negativas": { + "name": "plan_suscripcion_descargas_no_negativas", + "value": "\"plan_suscripcion\".\"descargas_incluidas\" >= 0" + }, + "plan_suscripcion_calidad_solo_con_descargas": { + "name": "plan_suscripcion_calidad_solo_con_descargas", + "value": "\"plan_suscripcion\".\"descargas_incluidas\" > 0 or \"plan_suscripcion\".\"calidad_descarga\" is null" + }, + "plan_suscripcion_capacidades_segun_ambito": { + "name": "plan_suscripcion_capacidades_segun_ambito", + "value": "(\n\t\t\t\t\"plan_suscripcion\".\"ambito\" = 'musica'\n\t\t\t\tand \"plan_suscripcion\".\"calidad_escucha\" is not null\n\t\t\t\tand not \"plan_suscripcion\".\"acceso_contenido_taller\"\n\t\t\t\tand not \"plan_suscripcion\".\"descarga_material_taller\"\n\t\t\t) or (\n\t\t\t\t\"plan_suscripcion\".\"ambito\" = 'taller_letras'\n\t\t\t\tand \"plan_suscripcion\".\"calidad_escucha\" is null\n\t\t\t\tand not \"plan_suscripcion\".\"incluye_publicidad\"\n\t\t\t\tand \"plan_suscripcion\".\"descargas_incluidas\" = 0\n\t\t\t\tand \"plan_suscripcion\".\"calidad_descarga\" is null\n\t\t\t\tand not \"plan_suscripcion\".\"acceso_versiones\"\n\t\t\t)" + }, + "plan_suscripcion_moneda_iso": { + "name": "plan_suscripcion_moneda_iso", + "value": "\"plan_suscripcion\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "plan_suscripcion_codigo_no_vacio": { + "name": "plan_suscripcion_codigo_no_vacio", + "value": "btrim(\"plan_suscripcion\".\"codigo\") <> ''" + }, + "plan_suscripcion_nombre_no_vacio": { + "name": "plan_suscripcion_nombre_no_vacio", + "value": "btrim(\"plan_suscripcion\".\"nombre\") <> ''" + }, + "plan_suscripcion_prestaciones_array": { + "name": "plan_suscripcion_prestaciones_array", + "value": "jsonb_typeof(\"plan_suscripcion\".\"prestaciones\") = 'array'" + } + }, + "isRLSEnabled": false + }, + "public.sesion": { + "name": "sesion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expira_en": { + "name": "expira_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sesion_usuario": { + "name": "sesion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "sesion_usuario_id_usuario_id_fk": { + "name": "sesion_usuario_id_usuario_id_fk", + "tableFrom": "sesion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.suscripcion": { + "name": "suscripcion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "plan_id": { + "name": "plan_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "inicia_en": { + "name": "inicia_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "termina_en": { + "name": "termina_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "proveedor": { + "name": "proveedor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "referencia_externa": { + "name": "referencia_externa", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "suscripcion_usuario_estado": { + "name": "suscripcion_usuario_estado", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "suscripcion_proveedor_referencia": { + "name": "suscripcion_proveedor_referencia", + "columns": [ + { + "expression": "proveedor", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "referencia_externa", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"suscripcion\".\"referencia_externa\" is not null", + "concurrently": false + } + }, + "foreignKeys": { + "suscripcion_plan_id_plan_suscripcion_id_fk": { + "name": "suscripcion_plan_id_plan_suscripcion_id_fk", + "tableFrom": "suscripcion", + "columnsFrom": [ + "plan_id" + ], + "tableTo": "plan_suscripcion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "suscripcion_usuario_id_usuario_id_fk": { + "name": "suscripcion_usuario_id_usuario_id_fk", + "tableFrom": "suscripcion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "suscripcion_periodo_valido": { + "name": "suscripcion_periodo_valido", + "value": "\"suscripcion\".\"termina_en\" is null or \"suscripcion\".\"termina_en\" > \"suscripcion\".\"inicia_en\"" + }, + "suscripcion_estado_conocido": { + "name": "suscripcion_estado_conocido", + "value": "\"suscripcion\".\"estado\" in ('pendiente', 'activa', 'pausada', 'cancelada', 'vencida')" + }, + "suscripcion_referencia_completa": { + "name": "suscripcion_referencia_completa", + "value": "(\"suscripcion\".\"proveedor\" is null) = (\"suscripcion\".\"referencia_externa\" is null)" + } + }, + "isRLSEnabled": false + }, + "public.usuario": { + "name": "usuario", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persona'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ultimo_acceso_en": { + "name": "ultimo_acceso_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "usuario_email_unique": { + "name": "usuario_email_unique", + "columns": [ + "email" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito": { + "name": "carrito", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "carrito_usuario_unico": { + "name": "carrito_usuario_unico", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"carrito\".\"usuario_id\" is not null", + "concurrently": false + } + }, + "foreignKeys": { + "carrito_usuario_id_usuario_id_fk": { + "name": "carrito_usuario_id_usuario_id_fk", + "tableFrom": "carrito", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito_item": { + "name": "carrito_item", + "schema": "", + "columns": { + "carrito_id": { + "name": "carrito_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "anadido_en": { + "name": "anadido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "carrito_item_carrito_id_carrito_id_fk": { + "name": "carrito_item_carrito_id_carrito_id_fk", + "tableFrom": "carrito_item", + "columnsFrom": [ + "carrito_id" + ], + "tableTo": "carrito", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "carrito_item_cancion_id_cancion_id_fk": { + "name": "carrito_item_cancion_id_cancion_id_fk", + "tableFrom": "carrito_item", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "carrito_item_carrito_id_cancion_id_pk": { + "name": "carrito_item_carrito_id_cancion_id_pk", + "columns": [ + "carrito_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.carrito_producto": { + "name": "carrito_producto", + "schema": "", + "columns": { + "carrito_id": { + "name": "carrito_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "producto_id": { + "name": "producto_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cantidad": { + "name": "cantidad", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "anadido_en": { + "name": "anadido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "carrito_producto_carrito_id_carrito_id_fk": { + "name": "carrito_producto_carrito_id_carrito_id_fk", + "tableFrom": "carrito_producto", + "columnsFrom": [ + "carrito_id" + ], + "tableTo": "carrito", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "carrito_producto_producto_id_producto_id_fk": { + "name": "carrito_producto_producto_id_producto_id_fk", + "tableFrom": "carrito_producto", + "columnsFrom": [ + "producto_id" + ], + "tableTo": "producto", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "carrito_producto_carrito_id_producto_id_pk": { + "name": "carrito_producto_carrito_id_producto_id_pk", + "columns": [ + "carrito_id", + "producto_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "carrito_producto_cantidad_positiva": { + "name": "carrito_producto_cantidad_positiva", + "value": "\"carrito_producto\".\"cantidad\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.compra": { + "name": "compra", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "comprado_en": { + "name": "comprado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "compra_usuario_id_usuario_id_fk": { + "name": "compra_usuario_id_usuario_id_fk", + "tableFrom": "compra", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "compra_cancion_id_cancion_id_fk": { + "name": "compra_cancion_id_cancion_id_fk", + "tableFrom": "compra", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "compra_pedido_id_pedido_id_fk": { + "name": "compra_pedido_id_pedido_id_fk", + "tableFrom": "compra", + "columnsFrom": [ + "pedido_id" + ], + "tableTo": "pedido", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "compra_usuario_id_cancion_id_pk": { + "name": "compra_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.intencion_pago": { + "name": "intencion_pago", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "huella": { + "name": "huella", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "datos": { + "name": "datos", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "sesion_pago_id": { + "name": "sesion_pago_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'abierta'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "intencion_pago_abierta": { + "name": "intencion_pago_abierta", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "huella", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"intencion_pago\".\"estado\" = 'abierta'", + "concurrently": false + } + }, + "foreignKeys": { + "intencion_pago_usuario_id_usuario_id_fk": { + "name": "intencion_pago_usuario_id_usuario_id_fk", + "tableFrom": "intencion_pago", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "intencion_pago_sesion_pago_id_unique": { + "name": "intencion_pago_sesion_pago_id_unique", + "columns": [ + "sesion_pago_id" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido": { + "name": "pedido", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sesion_pago_id": { + "name": "sesion_pago_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pendiente'" + }, + "packs": { + "name": "packs", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "pagado_en": { + "name": "pagado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "pedido_usuario": { + "name": "pedido_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "pedido_usuario_id_usuario_id_fk": { + "name": "pedido_usuario_id_usuario_id_fk", + "tableFrom": "pedido", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pedido_sesion_pago_id_unique": { + "name": "pedido_sesion_pago_id_unique", + "columns": [ + "sesion_pago_id" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido_item": { + "name": "pedido_item", + "schema": "", + "columns": { + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "titulo": { + "name": "titulo", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "pedido_item_pedido_id_pedido_id_fk": { + "name": "pedido_item_pedido_id_pedido_id_fk", + "tableFrom": "pedido_item", + "columnsFrom": [ + "pedido_id" + ], + "tableTo": "pedido", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "pedido_item_cancion_id_cancion_id_fk": { + "name": "pedido_item_cancion_id_cancion_id_fk", + "tableFrom": "pedido_item", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": { + "pedido_item_pedido_id_cancion_id_pk": { + "name": "pedido_item_pedido_id_cancion_id_pk", + "columns": [ + "pedido_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pedido_linea": { + "name": "pedido_linea", + "schema": "", + "columns": { + "pedido_id": { + "name": "pedido_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "producto_id": { + "name": "producto_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cantidad": { + "name": "cantidad", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "precio_unitario_centimos": { + "name": "precio_unitario_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_centimos": { + "name": "total_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "modalidad": { + "name": "modalidad", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "datos": { + "name": "datos", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": { + "pedido_linea_tipo": { + "name": "pedido_linea_tipo", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "pedido_linea_pedido_id_pedido_id_fk": { + "name": "pedido_linea_pedido_id_pedido_id_fk", + "tableFrom": "pedido_linea", + "columnsFrom": [ + "pedido_id" + ], + "tableTo": "pedido", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "pedido_linea_producto_id_producto_id_fk": { + "name": "pedido_linea_producto_id_producto_id_fk", + "tableFrom": "pedido_linea", + "columnsFrom": [ + "producto_id" + ], + "tableTo": "producto", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": { + "pedido_linea_pedido_id_codigo_pk": { + "name": "pedido_linea_pedido_id_codigo_pk", + "columns": [ + "pedido_id", + "codigo" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "pedido_linea_cantidad_positiva": { + "name": "pedido_linea_cantidad_positiva", + "value": "\"pedido_linea\".\"cantidad\" > 0" + }, + "pedido_linea_tipo_conocido": { + "name": "pedido_linea_tipo_conocido", + "value": "\"pedido_linea\".\"tipo\" in ('pack_canciones', 'libro', 'partitura', 'midi', 'stems', 'servicio', 'suscripcion')" + }, + "pedido_linea_modalidad_conocida": { + "name": "pedido_linea_modalidad_conocida", + "value": "\"pedido_linea\".\"modalidad\" in ('pago_unico', 'suscripcion')" + }, + "pedido_linea_importes_validos": { + "name": "pedido_linea_importes_validos", + "value": "\"pedido_linea\".\"precio_unitario_centimos\" >= 0 and \"pedido_linea\".\"total_centimos\" = \"pedido_linea\".\"precio_unitario_centimos\" * \"pedido_linea\".\"cantidad\"" + }, + "pedido_linea_moneda_iso": { + "name": "pedido_linea_moneda_iso", + "value": "\"pedido_linea\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "pedido_linea_datos_objeto": { + "name": "pedido_linea_datos_objeto", + "value": "jsonb_typeof(\"pedido_linea\".\"datos\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.producto": { + "name": "producto", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "codigo": { + "name": "codigo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tipo": { + "name": "tipo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "descripcion": { + "name": "descripcion", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estado": { + "name": "estado", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'borrador'" + }, + "precio_centimos": { + "name": "precio_centimos", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "moneda": { + "name": "moneda", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'eur'" + }, + "metadatos": { + "name": "metadatos", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizado_en": { + "name": "actualizado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "producto_tipo_estado": { + "name": "producto_tipo_estado", + "columns": [ + { + "expression": "tipo", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "estado", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "producto_codigo_unique": { + "name": "producto_codigo_unique", + "columns": [ + "codigo" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": { + "producto_tipo_conocido": { + "name": "producto_tipo_conocido", + "value": "\"producto\".\"tipo\" in ('libro', 'partitura', 'midi', 'stems', 'servicio')" + }, + "producto_estado_conocido": { + "name": "producto_estado_conocido", + "value": "\"producto\".\"estado\" in ('borrador', 'disponible', 'retirado')" + }, + "producto_precio_no_negativo": { + "name": "producto_precio_no_negativo", + "value": "\"producto\".\"precio_centimos\" >= 0" + }, + "producto_moneda_iso": { + "name": "producto_moneda_iso", + "value": "\"producto\".\"moneda\" ~ '^[a-z]{3}$'" + }, + "producto_codigo_no_vacio": { + "name": "producto_codigo_no_vacio", + "value": "btrim(\"producto\".\"codigo\") <> ''" + }, + "producto_nombre_no_vacio": { + "name": "producto_nombre_no_vacio", + "value": "btrim(\"producto\".\"nombre\") <> ''" + }, + "producto_metadatos_objeto": { + "name": "producto_metadatos_objeto", + "value": "jsonb_typeof(\"producto\".\"metadatos\") = 'object'" + } + }, + "isRLSEnabled": false + }, + "public.acceso_cancion_usuario": { + "name": "acceso_cancion_usuario", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "concedido_en": { + "name": "concedido_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "acceso_cancion_usuario_cancion": { + "name": "acceso_cancion_usuario_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "acceso_cancion_usuario_usuario_id_usuario_id_fk": { + "name": "acceso_cancion_usuario_usuario_id_usuario_id_fk", + "tableFrom": "acceso_cancion_usuario", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "acceso_cancion_usuario_cancion_id_cancion_id_fk": { + "name": "acceso_cancion_usuario_cancion_id_cancion_id_fk", + "tableFrom": "acceso_cancion_usuario", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "acceso_cancion_usuario_usuario_id_cancion_id_pk": { + "name": "acceso_cancion_usuario_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.favorito": { + "name": "favorito", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "marcado_en": { + "name": "marcado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_favorito_usuario": { + "name": "idx_favorito_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "favorito_usuario_id_usuario_id_fk": { + "name": "favorito_usuario_id_usuario_id_fk", + "tableFrom": "favorito", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "favorito_cancion_id_cancion_id_fk": { + "name": "favorito_cancion_id_cancion_id_fk", + "tableFrom": "favorito", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "favorito_usuario_id_cancion_id_pk": { + "name": "favorito_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lista_reproduccion": { + "name": "lista_reproduccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nombre": { + "name": "nombre", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lista_reproduccion_usuario": { + "name": "lista_reproduccion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "lista_reproduccion_nombre_usuario": { + "name": "lista_reproduccion_nombre_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(btrim(\"nombre\"))", + "isExpression": true, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "lista_reproduccion_usuario_id_usuario_id_fk": { + "name": "lista_reproduccion_usuario_id_usuario_id_fk", + "tableFrom": "lista_reproduccion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "lista_reproduccion_nombre_valido": { + "name": "lista_reproduccion_nombre_valido", + "value": "nullif(btrim(\"lista_reproduccion\".\"nombre\"), '') is not null and char_length(btrim(\"lista_reproduccion\".\"nombre\")) <= 80" + } + }, + "isRLSEnabled": false + }, + "public.lista_reproduccion_cancion": { + "name": "lista_reproduccion_cancion", + "schema": "", + "columns": { + "lista_id": { + "name": "lista_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "orden": { + "name": "orden", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "anadida_en": { + "name": "anadida_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lista_reproduccion_orden_unico": { + "name": "lista_reproduccion_orden_unico", + "columns": [ + { + "expression": "lista_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "orden", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "lista_reproduccion_cancion_tema": { + "name": "lista_reproduccion_cancion_tema", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "lista_reproduccion_cancion_lista_id_lista_reproduccion_id_fk": { + "name": "lista_reproduccion_cancion_lista_id_lista_reproduccion_id_fk", + "tableFrom": "lista_reproduccion_cancion", + "columnsFrom": [ + "lista_id" + ], + "tableTo": "lista_reproduccion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "lista_reproduccion_cancion_cancion_id_cancion_id_fk": { + "name": "lista_reproduccion_cancion_cancion_id_cancion_id_fk", + "tableFrom": "lista_reproduccion_cancion", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "lista_reproduccion_cancion_lista_id_cancion_id_pk": { + "name": "lista_reproduccion_cancion_lista_id_cancion_id_pk", + "columns": [ + "lista_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "lista_reproduccion_orden_positivo": { + "name": "lista_reproduccion_orden_positivo", + "value": "\"lista_reproduccion_cancion\".\"orden\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.reproduccion": { + "name": "reproduccion", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "segundos": { + "name": "segundos", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "dia": { + "name": "dia", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "creado_en": { + "name": "creado_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "reproduccion_dia": { + "name": "reproduccion_dia", + "columns": [ + { + "expression": "dia", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "reproduccion_cancion": { + "name": "reproduccion_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "reproduccion_usuario": { + "name": "reproduccion_usuario", + "columns": [ + { + "expression": "usuario_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "reproduccion_cancion_id_cancion_id_fk": { + "name": "reproduccion_cancion_id_cancion_id_fk", + "tableFrom": "reproduccion", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "reproduccion_usuario_id_usuario_id_fk": { + "name": "reproduccion_usuario_id_usuario_id_fk", + "tableFrom": "reproduccion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.valoracion": { + "name": "valoracion", + "schema": "", + "columns": { + "usuario_id": { + "name": "usuario_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cancion_id": { + "name": "cancion_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "puntuacion": { + "name": "puntuacion", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "creada_en": { + "name": "creada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actualizada_en": { + "name": "actualizada_en", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_valoracion_cancion": { + "name": "idx_valoracion_cancion", + "columns": [ + { + "expression": "cancion_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "valoracion_usuario_id_usuario_id_fk": { + "name": "valoracion_usuario_id_usuario_id_fk", + "tableFrom": "valoracion", + "columnsFrom": [ + "usuario_id" + ], + "tableTo": "usuario", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "valoracion_cancion_id_cancion_id_fk": { + "name": "valoracion_cancion_id_cancion_id_fk", + "tableFrom": "valoracion", + "columnsFrom": [ + "cancion_id" + ], + "tableTo": "cancion", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "valoracion_usuario_id_cancion_id_pk": { + "name": "valoracion_usuario_id_cancion_id_pk", + "columns": [ + "usuario_id", + "cancion_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.acceso_cancion": { + "name": "acceso_cancion", + "schema": "public", + "values": [ + "ninguna", + "publico", + "exclusiva", + "privada" + ] + }, + "public.formacion_vocal": { + "name": "formacion_vocal", + "schema": "public", + "values": [ + "hombre", + "mujer", + "dueto-femenino", + "dueto-masculino", + "dueto-mixto", + "multiple-mixto", + "multiple-femenino", + "multiple-masculino" + ] + } + }, + "schemas": {}, + "views": {}, + "sequences": { + "public.artista_codigo_seq": { + "name": "artista_codigo_seq", + "increment": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + }, + "public.artista_virtual_codigo_seq": { + "name": "artista_virtual_codigo_seq", + "increment": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + }, + "public.cancion_codigo_seq": { + "name": "cancion_codigo_seq", + "increment": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "roles": {}, + "policies": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index f2c92a1..89d9152 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -232,6 +232,20 @@ "when": 1789255031254, "tag": "0032_bent_hydra", "breakpoints": true + }, + { + "idx": 33, + "version": "7", + "when": 1789256088294, + "tag": "0033_superb_silverclaw", + "breakpoints": true + }, + { + "idx": 34, + "version": "7", + "when": 1789256852614, + "tag": "0034_planes_en_espanol", + "breakpoints": true } ] } \ No newline at end of file diff --git a/e2e/suscripciones.e2e.ts b/e2e/suscripciones.e2e.ts index 2579afd..0b1233a 100644 --- a/e2e/suscripciones.e2e.ts +++ b/e2e/suscripciones.e2e.ts @@ -7,13 +7,25 @@ test.describe('Suscripciones', () => { await page.goto('/suscripciones'); await expect(page.getByRole('heading', { level: 1, name: 'Suscripciones' })).toBeVisible(); - await expect(page.getByRole('heading', { level: 3, name: 'Follower' })).toBeVisible(); - await expect(page.getByRole('heading', { level: 3, name: 'Friend' })).toBeVisible(); - await expect(page.getByRole('heading', { level: 3, name: 'VIP' })).toBeVisible(); + await expect(page.getByRole('heading', { level: 3, name: 'Seguidor' })).toBeVisible(); + await expect( + page.getByRole('heading', { level: 3, name: 'Amigo', exact: true }) + ).toBeVisible(); + await expect(page.getByRole('heading', { level: 3, name: 'Buen amigo' })).toBeVisible(); + await expect(page.getByRole('heading', { level: 3, name: 'Taller de letras' })).toBeVisible(); await expect(page.getByText('Escucha con publicidad')).toBeVisible(); await expect(page.getByText('30 descargas en calidad media')).toBeVisible(); await expect(page.getByText('100 descargas', { exact: true })).toBeVisible(); await expect(page.getByText('Acceso a versiones')).toBeVisible(); + await expect(page.getByText('Acceso a todo el contenido')).toBeVisible(); + await expect(page.getByText('Descarga de todo el material')).toBeVisible(); + await expect(page.getByRole('link', { name: 'Empezar gratis' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'Elegir Amigo' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'Elegir Buen amigo' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'Acceder al taller' })).toBeVisible(); + await expect(page.getByText(/Ordenados de menor a mayor nivel/i)).toHaveCount(0); + await expect(page.getByText(/Nivel [123]/i)).toHaveCount(0); + await expect(page.getByText(/Consultar (?:este )?plan/i)).toHaveCount(0); await expect( page.getByRole('heading', { level: 2, name: 'Suscripción y compra no son lo mismo' }) ).toBeVisible(); diff --git a/scripts/db/comprobar-guardas.mjs b/scripts/db/comprobar-guardas.mjs index 8a3c908..a7b7577 100644 --- a/scripts/db/comprobar-guardas.mjs +++ b/scripts/db/comprobar-guardas.mjs @@ -266,6 +266,20 @@ await rechaza( (id, codigo, nombre, nivel, precio_centimos, periodicidad, calidad_descarga) values ('ps4', 'zz-calidad', 'Roto', 2, 500, 'mes', 'media')` ); +await rechaza( + 'un plan del taller no mezcla capacidades de música', + `insert into plan_suscripcion + (id, codigo, nombre, nivel, precio_centimos, periodicidad, ambito, calidad_escucha, + acceso_contenido_taller, descarga_material_taller) + values ('ps5', 'zz-taller-mal', 'Roto', 1, 990, 'ano', 'taller_letras', 'alta', true, true)` +); +await permite( + 'un plan del taller conserva el acceso y la descarga de materiales', + `insert into plan_suscripcion + (id, codigo, nombre, nivel, precio_centimos, periodicidad, ambito, calidad_escucha, + acceso_contenido_taller, descarga_material_taller) + values ('ps6', 'zz-taller', 'Taller', 1, 990, 'ano', 'taller_letras', null, true, true)` +); await permite( 'un libro disponible se puede añadir al carrito con cantidad', `insert into producto diff --git a/src/lib/server/acceso-canciones.ts b/src/lib/server/acceso-canciones.ts index f4feeb2..45d3aae 100644 --- a/src/lib/server/acceso-canciones.ts +++ b/src/lib/server/acceso-canciones.ts @@ -1,28 +1,31 @@ -import { and, eq, gt, isNull, lte, or } from 'drizzle-orm'; +import { and, eq, gt, isNull, lte, or, sql } from 'drizzle-orm'; import type { ContextoDeAccesoCanciones } from '$lib/acceso-canciones'; import type { AccesoCancion } from '$lib/canciones'; import { db } from './db'; -import { accesoCancionUsuario, cancion, suscripcion } from './db/schema'; +import { accesoCancionUsuario, cancion, planSuscripcion, suscripcion } from './db/schema'; const SIN_ACCESO: ContextoDeAccesoCanciones = { suscripcionActiva: false, accesosPrivados: [] }; -async function tieneSuscripcionActiva(usuarioId: string): Promise { - const ahora = new Date(); - const [periodo] = await db +async function tieneSuscripcionMusicalActiva(usuarioId: string): Promise { + const consulta = db .select({ id: suscripcion.id }) .from(suscripcion) + .leftJoin(planSuscripcion, eq(planSuscripcion.id, suscripcion.planId)) .where( and( eq(suscripcion.usuarioId, usuarioId), eq(suscripcion.estado, 'activa'), - lte(suscripcion.iniciaEn, ahora), - or(isNull(suscripcion.terminaEn), gt(suscripcion.terminaEn, ahora)) + lte(suscripcion.iniciaEn, sql`CURRENT_TIMESTAMP`), + or(isNull(suscripcion.terminaEn), gt(suscripcion.terminaEn, sql`CURRENT_TIMESTAMP`)), + // Las concesiones manuales antiguas no tenían plan y siguen siendo musicales. + or(isNull(suscripcion.planId), eq(planSuscripcion.ambito, 'musica')) ) ) .limit(1); + const [periodo] = await consulta; return Boolean(periodo); } @@ -33,7 +36,7 @@ export async function contextoDeAccesoCanciones( if (!usuarioId) return SIN_ACCESO; const [suscripcionActiva, concesiones] = await Promise.all([ - tieneSuscripcionActiva(usuarioId), + tieneSuscripcionMusicalActiva(usuarioId), db .select({ slug: cancion.slug }) .from(accesoCancionUsuario) @@ -57,7 +60,7 @@ export async function usuarioPuedeEscuchar( if (acceso === 'ninguna' || !usuarioId) return false; if (acceso === 'exclusiva') { - return tieneSuscripcionActiva(usuarioId); + return tieneSuscripcionMusicalActiva(usuarioId); } const [concesion] = await db diff --git a/src/lib/server/db/schema/cuentas.ts b/src/lib/server/db/schema/cuentas.ts index c1d58f9..84c25c9 100644 --- a/src/lib/server/db/schema/cuentas.ts +++ b/src/lib/server/db/schema/cuentas.ts @@ -19,7 +19,7 @@ import { import { sql } from 'drizzle-orm'; import { ahora, id, instante } from './comun'; import { ESTADOS_PLAN_SUSCRIPCION, PERIODICIDADES } from '../../../comercio'; -import { CALIDADES_AUDIO_SUSCRIPCION } from '../../../suscripciones'; +import { AMBITOS_PLAN_SUSCRIPCION, CALIDADES_AUDIO_SUSCRIPCION } from '../../../suscripciones'; /* ------------------------------------------------------------------------- * Cuentas @@ -78,13 +78,14 @@ export const planSuscripcion = pgTable( moneda: text('moneda').notNull().default('eur'), periodicidad: text('periodicidad', { enum: PERIODICIDADES }).notNull(), intervalos: integer('intervalos').notNull().default(1), + ambito: text('ambito', { enum: AMBITOS_PLAN_SUSCRIPCION }).notNull().default('musica'), incluyePublicidad: boolean('incluye_publicidad').notNull().default(false), - calidadEscucha: text('calidad_escucha', { enum: CALIDADES_AUDIO_SUSCRIPCION }) - .notNull() - .default('media'), + calidadEscucha: text('calidad_escucha', { enum: CALIDADES_AUDIO_SUSCRIPCION }).default('media'), descargasIncluidas: integer('descargas_incluidas').notNull().default(0), calidadDescarga: text('calidad_descarga', { enum: CALIDADES_AUDIO_SUSCRIPCION }), accesoVersiones: boolean('acceso_versiones').notNull().default(false), + accesoContenidoTaller: boolean('acceso_contenido_taller').notNull().default(false), + descargaMaterialTaller: boolean('descarga_material_taller').notNull().default(false), referenciaPrecioExterna: text('referencia_precio_externa').unique(), prestaciones: jsonb('prestaciones').notNull().default([]).$type(), estado: text('estado', { enum: ESTADOS_PLAN_SUSCRIPCION }).notNull().default('borrador'), @@ -104,9 +105,10 @@ export const planSuscripcion = pgTable( check('plan_suscripcion_nivel_positivo', sql`${t.nivel} > 0`), check('plan_suscripcion_precio_no_negativo', sql`${t.precioCentimos} >= 0`), check('plan_suscripcion_intervalos_positivos', sql`${t.intervalos} > 0`), + check('plan_suscripcion_ambito_conocido', sql`${t.ambito} in ('musica', 'taller_letras')`), check( 'plan_suscripcion_calidad_escucha_conocida', - sql`${t.calidadEscucha} in ('media', 'alta')` + sql`${t.calidadEscucha} is null or ${t.calidadEscucha} in ('media', 'alta')` ), check( 'plan_suscripcion_calidad_descarga_conocida', @@ -117,6 +119,22 @@ export const planSuscripcion = pgTable( 'plan_suscripcion_calidad_solo_con_descargas', sql`${t.descargasIncluidas} > 0 or ${t.calidadDescarga} is null` ), + check( + 'plan_suscripcion_capacidades_segun_ambito', + sql`( + ${t.ambito} = 'musica' + and ${t.calidadEscucha} is not null + and not ${t.accesoContenidoTaller} + and not ${t.descargaMaterialTaller} + ) or ( + ${t.ambito} = 'taller_letras' + and ${t.calidadEscucha} is null + and not ${t.incluyePublicidad} + and ${t.descargasIncluidas} = 0 + and ${t.calidadDescarga} is null + and not ${t.accesoVersiones} + )` + ), check('plan_suscripcion_moneda_iso', sql`${t.moneda} ~ '^[a-z]{3}$'`), check('plan_suscripcion_codigo_no_vacio', sql`btrim(${t.codigo}) <> ''`), check('plan_suscripcion_nombre_no_vacio', sql`btrim(${t.nombre}) <> ''`), diff --git a/src/lib/server/integracion-postgres.spec.ts b/src/lib/server/integracion-postgres.spec.ts index ecfaaf6..aae783b 100644 --- a/src/lib/server/integracion-postgres.spec.ts +++ b/src/lib/server/integracion-postgres.spec.ts @@ -34,6 +34,7 @@ import { renombrarLista, moverEnLista, borrarLista, listasDeUsuario } from './li import { concederSuscripcion, revocarSuscripcion } from './operaciones'; import { resumirCarrito } from '$lib/tienda'; import { planesDeSuscripcionPublicos } from './suscripciones'; +import { usuarioPuedeEscuchar } from './acceso-canciones'; const conexion = process.env.TEST_DATABASE_URL; describe.runIf(!!conexion)('PostgreSQL con tablas temporales aisladas', () => { @@ -252,6 +253,7 @@ describe.runIf(!!conexion)('PostgreSQL con tablas temporales aisladas', () => { expect(planes[0]).toMatchObject({ codigo: 'apoyo', nombre: 'Apoyo', + ambito: 'musica', incluyePublicidad: false, calidadEscucha: 'alta', descargasIncluidas: 30, @@ -261,6 +263,24 @@ describe.runIf(!!conexion)('PostgreSQL con tablas temporales aisladas', () => { }); expect(planes[0]).not.toHaveProperty('referenciaPrecioExterna'); }); + it('una suscripción del taller no desbloquea el catálogo musical exclusivo', async () => { + await cliente.query( + `INSERT INTO plan_suscripcion + (id,codigo,nombre,nivel,precio_centimos,periodicidad,ambito,calidad_escucha, + acceso_contenido_taller,descarga_material_taller,estado) + VALUES + ('spt','taller-prueba','Taller',1,990,'ano','taller_letras',null,true,true,'disponible'), + ('spm','musica-prueba','Música',1,990,'ano','musica','alta',false,false,'disponible'); + INSERT INTO suscripcion (id,usuario_id,plan_id,estado) + VALUES ('st','u','spt','activa')` + ); + + expect(await usuarioPuedeEscuchar('u', 'exclusiva', 'tema')).toBe(false); + await cliente.query( + "INSERT INTO suscripcion (id,usuario_id,plan_id,estado) VALUES ('sm','u','spm','activa')" + ); + expect(await usuarioPuedeEscuchar('u', 'exclusiva', 'tema')).toBe(true); + }); it('una sesión existente no admite otro propietario', async () => { await expect( crearPedido({ diff --git a/src/lib/server/suscripciones.ts b/src/lib/server/suscripciones.ts index 26addce..16ddee8 100644 --- a/src/lib/server/suscripciones.ts +++ b/src/lib/server/suscripciones.ts @@ -1,6 +1,6 @@ -import { asc, eq } from 'drizzle-orm'; +import { and, asc, eq, gt, isNotNull, isNull, lte, or, sql } from 'drizzle-orm'; import { db } from './db'; -import { planSuscripcion } from './db/schema'; +import { planSuscripcion, suscripcion } from './db/schema'; /** * Planes que se pueden enseñar públicamente. @@ -20,16 +20,23 @@ export async function planesDeSuscripcionPublicos() { moneda: planSuscripcion.moneda, periodicidad: planSuscripcion.periodicidad, intervalos: planSuscripcion.intervalos, + ambito: planSuscripcion.ambito, incluyePublicidad: planSuscripcion.incluyePublicidad, calidadEscucha: planSuscripcion.calidadEscucha, descargasIncluidas: planSuscripcion.descargasIncluidas, calidadDescarga: planSuscripcion.calidadDescarga, accesoVersiones: planSuscripcion.accesoVersiones, + accesoContenidoTaller: planSuscripcion.accesoContenidoTaller, + descargaMaterialTaller: planSuscripcion.descargaMaterialTaller, prestaciones: planSuscripcion.prestaciones }) .from(planSuscripcion) .where(eq(planSuscripcion.estado, 'disponible')) - .orderBy(asc(planSuscripcion.nivel), asc(planSuscripcion.precioCentimos)); + .orderBy( + asc(planSuscripcion.ambito), + asc(planSuscripcion.nivel), + asc(planSuscripcion.precioCentimos) + ); return filas.map((plan) => ({ ...plan, @@ -39,3 +46,23 @@ export async function planesDeSuscripcionPublicos() { ) })); } + +/** Planes concretos que la cuenta tiene vigentes; admite varios ámbitos a la vez. */ +export async function planesDeSuscripcionActivos(usuarioId?: string): Promise { + if (!usuarioId) return []; + + const filas = await db + .select({ planId: suscripcion.planId }) + .from(suscripcion) + .where( + and( + eq(suscripcion.usuarioId, usuarioId), + eq(suscripcion.estado, 'activa'), + isNotNull(suscripcion.planId), + lte(suscripcion.iniciaEn, sql`CURRENT_TIMESTAMP`), + or(isNull(suscripcion.terminaEn), gt(suscripcion.terminaEn, sql`CURRENT_TIMESTAMP`)) + ) + ); + + return filas.flatMap(({ planId }) => (planId ? [planId] : [])); +} diff --git a/src/lib/suscripciones.spec.ts b/src/lib/suscripciones.spec.ts index 632efed..b81e9d9 100644 --- a/src/lib/suscripciones.spec.ts +++ b/src/lib/suscripciones.spec.ts @@ -17,11 +17,14 @@ describe('prestacionesDePlan', () => { it('describe las capacidades estructuradas sin depender del código del plan', () => { expect( prestacionesDePlan({ + ambito: 'musica', incluyePublicidad: false, calidadEscucha: 'alta', descargasIncluidas: 30, calidadDescarga: 'media', accesoVersiones: false, + accesoContenidoTaller: false, + descargaMaterialTaller: false, prestaciones: [] }) ).toEqual(['Calidad de escucha alta', 'Sin publicidad', '30 descargas en calidad media']); @@ -30,11 +33,14 @@ describe('prestacionesDePlan', () => { it('añade acceso a versiones y conserva prestaciones editoriales no duplicadas', () => { expect( prestacionesDePlan({ + ambito: 'musica', incluyePublicidad: false, calidadEscucha: 'alta', descargasIncluidas: 100, calidadDescarga: null, accesoVersiones: true, + accesoContenidoTaller: false, + descargaMaterialTaller: false, prestaciones: ['Acceso anticipado', 'Acceso a versiones', ' '] }) ).toEqual([ @@ -45,4 +51,20 @@ describe('prestacionesDePlan', () => { 'Acceso anticipado' ]); }); + + it('describe el taller sin mezclar prestaciones de escucha', () => { + expect( + prestacionesDePlan({ + ambito: 'taller_letras', + incluyePublicidad: false, + calidadEscucha: null, + descargasIncluidas: 0, + calidadDescarga: null, + accesoVersiones: false, + accesoContenidoTaller: true, + descargaMaterialTaller: true, + prestaciones: [] + }) + ).toEqual(['Acceso a todo el contenido', 'Descarga de todo el material']); + }); }); diff --git a/src/lib/suscripciones.ts b/src/lib/suscripciones.ts index 30bb937..ae6b4f9 100644 --- a/src/lib/suscripciones.ts +++ b/src/lib/suscripciones.ts @@ -3,12 +3,18 @@ import type { Periodicidad } from './comercio'; export const CALIDADES_AUDIO_SUSCRIPCION = ['media', 'alta'] as const; export type CalidadAudioSuscripcion = (typeof CALIDADES_AUDIO_SUSCRIPCION)[number]; +export const AMBITOS_PLAN_SUSCRIPCION = ['musica', 'taller_letras'] as const; +export type AmbitoPlanSuscripcion = (typeof AMBITOS_PLAN_SUSCRIPCION)[number]; + export interface CapacidadesPlanSuscripcion { + ambito: AmbitoPlanSuscripcion; incluyePublicidad: boolean; - calidadEscucha: CalidadAudioSuscripcion; + calidadEscucha: CalidadAudioSuscripcion | null; descargasIncluidas: number; calidadDescarga: CalidadAudioSuscripcion | null; accesoVersiones: boolean; + accesoContenidoTaller: boolean; + descargaMaterialTaller: boolean; prestaciones: readonly string[]; } @@ -27,20 +33,27 @@ export function periodoDeSuscripcion(periodicidad: Periodicidad, intervalos: num /** Convierte las capacidades aplicables por el sistema en textos para la ficha pública. */ export function prestacionesDePlan(plan: CapacidadesPlanSuscripcion): string[] { - const prestaciones = [ - `Calidad de escucha ${plan.calidadEscucha}`, - plan.incluyePublicidad ? 'Escucha con publicidad' : 'Sin publicidad' - ]; - - if (plan.descargasIncluidas > 0) { - prestaciones.push( - `${plan.descargasIncluidas} descargas${ - plan.calidadDescarga ? ` en calidad ${plan.calidadDescarga}` : '' - }` - ); + const prestaciones: string[] = []; + + if (plan.ambito === 'musica') { + if (plan.calidadEscucha) prestaciones.push(`Calidad de escucha ${plan.calidadEscucha}`); + prestaciones.push(plan.incluyePublicidad ? 'Escucha con publicidad' : 'Sin publicidad'); + + if (plan.descargasIncluidas > 0) { + prestaciones.push( + `${plan.descargasIncluidas} descargas${ + plan.calidadDescarga ? ` en calidad ${plan.calidadDescarga}` : '' + }` + ); + } + + if (plan.accesoVersiones) prestaciones.push('Acceso a versiones'); } - if (plan.accesoVersiones) prestaciones.push('Acceso a versiones'); + if (plan.ambito === 'taller_letras') { + if (plan.accesoContenidoTaller) prestaciones.push('Acceso a todo el contenido'); + if (plan.descargaMaterialTaller) prestaciones.push('Descarga de todo el material'); + } for (const prestacion of plan.prestaciones) { const texto = prestacion.trim(); @@ -49,3 +62,8 @@ export function prestacionesDePlan(plan: CapacidadesPlanSuscripcion): string[] { return prestaciones; } + +/** Etiqueta editorial del ámbito, independiente del nombre comercial del plan. */ +export function etiquetaDeAmbito(plan: Pick): string { + return plan.ambito === 'taller_letras' ? 'Formación' : 'Música'; +} diff --git a/src/routes/(sitio)/suscripciones/+page.server.ts b/src/routes/(sitio)/suscripciones/+page.server.ts index b69f3e8..5a09373 100644 --- a/src/routes/(sitio)/suscripciones/+page.server.ts +++ b/src/routes/(sitio)/suscripciones/+page.server.ts @@ -1,5 +1,10 @@ -import { planesDeSuscripcionPublicos } from '$lib/server/suscripciones'; +import { planesDeSuscripcionActivos, planesDeSuscripcionPublicos } from '$lib/server/suscripciones'; -export async function load() { - return { planes: await planesDeSuscripcionPublicos() }; +export async function load({ locals }) { + const [planes, planesActivos] = await Promise.all([ + planesDeSuscripcionPublicos(), + planesDeSuscripcionActivos(locals.usuario?.id) + ]); + + return { planes, planesActivos }; } diff --git a/src/routes/(sitio)/suscripciones/+page.svelte b/src/routes/(sitio)/suscripciones/+page.svelte index a8ae131..69176fd 100644 --- a/src/routes/(sitio)/suscripciones/+page.svelte +++ b/src/routes/(sitio)/suscripciones/+page.svelte @@ -1,11 +1,18 @@ Escucha y apoyo

Suscripciones

- Elige el nivel que encaje contigo. Una suscripción activa permite escuchar el contenido - exclusivo; cada plan detalla además sus propias prestaciones. + Elige el acceso que encaje contigo. Hay planes para escuchar música y un acceso específico al + Taller de letras; cada uno detalla sus propias prestaciones.

{#if data.planes.length > 0}
-

Tipos de suscripción

-

Ordenados de menor a mayor nivel.

+

Escucha

+

Suscripciones de música

+

+ Tres formas de disfrutar el catálogo, desde el acceso gratuito hasta la experiencia + completa. +

-
    - {#each data.planes as plan (plan.id)} - {@const prestaciones = prestacionesDePlan(plan)} -
  • -
    -
    -

    Nivel {plan.nivel}

    -

    {plan.nombre}

    - {#if plan.descripcion} -

    {plan.descripcion}

    - {/if} -
    - -

    - {formatearPrecio(plan.precioCentimos, 'es-ES', plan.moneda)} - {periodoDeSuscripcion(plan.periodicidad, plan.intervalos)} - {#if plan.precioCentimos === 0}Gratis{/if} -

    - - {#if prestaciones.length > 0} -
      - {#each prestaciones as prestacion (prestacion)} -
    • {prestacion}
    • - {/each} -
    - {:else} -

    - Las prestaciones se anunciarán antes de abrir el plan. -

    - {/if} - - {#if data.suscripcionActiva} - Gestionar mi suscripción - {:else} - pedirContacto(evento)} - > - Consultar este plan - - {/if} -
    -
  • +
      + {#each data.planes.filter((plan) => plan.ambito === 'musica') as plan (plan.id)} + {@render tarjeta(plan)} {/each}
    + + {#if data.planes.some((plan) => plan.ambito !== 'musica')} +
    +
    +

    Otras suscripciones

    +

    + Accesos independientes de la suscripción musical, pensados para aprender y trabajar + con los contenidos del proyecto. +

    +
    +
      + {#each data.planes.filter((plan) => plan.ambito !== 'musica') as plan (plan.id)} + {@render tarjeta(plan)} + {/each} +
    +
    + {/if}
{:else}

Próximamente

Estamos definiendo los primeros planes

- Publicaremos aquí cada nivel con su precio, periodicidad y prestaciones antes de abrir las + Publicaremos aquí cada opción con su precio, periodicidad y prestaciones antes de abrir las suscripciones.

- pedirContacto(evento)}> - Pedir información - + Crear mi cuenta
{/if} @@ -107,6 +92,72 @@ +{#snippet tarjeta(plan: (typeof data.planes)[number])} + {@const prestaciones = prestacionesDePlan(plan)} +
  • +
    +
    +
    +

    {etiquetaDeAmbito(plan)}

    + +
    +

    {plan.nombre}

    + {#if plan.descripcion}

    {plan.descripcion}

    {/if} +
    + +
    +

    + + {plan.precioCentimos === 0 + ? '0 €' + : formatearPrecio(plan.precioCentimos, 'es-ES', plan.moneda)} + + {periodoDeSuscripcion(plan.periodicidad, plan.intervalos)} +

    +

    + {plan.precioCentimos === 0 ? 'Acceso gratuito' : 'Facturación anual'} +

    +
    + + {#if prestaciones.length > 0} +
      + {#each prestaciones as prestacion (prestacion)}
    • {prestacion}
    • {/each} +
    + {/if} + + {#if data.planesActivos.includes(plan.id)} + Gestionar mi suscripción + {:else} + + {textoDeAccion(plan)} + + {/if} +
    +
  • +{/snippet} +