El usuario ha puesto un servidor con PostgreSQL 16, así que la base pasa allí. El catálogo no se toca: sigue siendo Markdown del repositorio; lo que se muda es lo que generan las personas, que es lo único que estaba en la base. Dos diferencias entre motores que habrían pasado desapercibidas y se cazaron comprobando con datos de verdad, no compilando: - `integer` en Postgres son cuatro bytes y en SQLite ocho. El limitador de envíos guarda su vencimiento en milisegundos desde 1970 —trece dígitos, del orden del billón— y en `integer` desbordaría, dejando de limitar. Va en `bigint`. - `avg()` y `count()` los entrega el driver como cadena para no perder precisión. Sin convertirlas, `cuantas === 0` nunca se cumpliría y «1 voto» saldría siempre en plural. Se convierten en la consulta. Verificado contra el servidor: once tablas creadas, las 113 pruebas de extremo a extremo y las 224 unitarias en verde, el servidor de producción arrancando, el limitador escribiendo sus trece dígitos y el borrado en cascada llevándose valoraciones y favoritos al borrar una cuenta. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>master
parent
ef7f1e0b04
commit
3aebf91085
@ -0,0 +1,106 @@
|
||||
CREATE TABLE "carrito" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"usuario_id" text,
|
||||
"creado_en" timestamp with time zone NOT NULL,
|
||||
"actualizado_en" timestamp with time zone NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "carrito_item" (
|
||||
"carrito_id" text NOT NULL,
|
||||
"cancion_slug" text NOT NULL,
|
||||
"anadido_en" timestamp with time zone NOT NULL,
|
||||
CONSTRAINT "carrito_item_carrito_id_cancion_slug_pk" PRIMARY KEY("carrito_id","cancion_slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "codigo_acceso" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"email" text NOT NULL,
|
||||
"hash" text NOT NULL,
|
||||
"expira_en" timestamp with time zone NOT NULL,
|
||||
"intentos" integer DEFAULT 0 NOT NULL,
|
||||
"usado_en" timestamp with time zone,
|
||||
"creado_en" timestamp with time zone NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "compra" (
|
||||
"usuario_id" text NOT NULL,
|
||||
"cancion_slug" text NOT NULL,
|
||||
"pedido_id" text NOT NULL,
|
||||
"comprado_en" timestamp with time zone NOT NULL,
|
||||
CONSTRAINT "compra_usuario_id_cancion_slug_pk" PRIMARY KEY("usuario_id","cancion_slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "favorito" (
|
||||
"usuario_id" text NOT NULL,
|
||||
"cancion_slug" text NOT NULL,
|
||||
"marcado_en" timestamp with time zone NOT NULL,
|
||||
CONSTRAINT "favorito_usuario_id_cancion_slug_pk" PRIMARY KEY("usuario_id","cancion_slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "limite" (
|
||||
"clave" text PRIMARY KEY NOT NULL,
|
||||
"intentos" integer NOT NULL,
|
||||
"expira_en" bigint NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "pedido" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"usuario_id" text NOT NULL,
|
||||
"sesion_pago_id" text NOT NULL,
|
||||
"estado" text DEFAULT 'pendiente' NOT NULL,
|
||||
"packs" integer NOT NULL,
|
||||
"total_centimos" integer NOT NULL,
|
||||
"moneda" text DEFAULT 'eur' NOT NULL,
|
||||
"creado_en" timestamp with time zone NOT NULL,
|
||||
"pagado_en" timestamp with time zone,
|
||||
CONSTRAINT "pedido_sesion_pago_id_unique" UNIQUE("sesion_pago_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "pedido_item" (
|
||||
"pedido_id" text NOT NULL,
|
||||
"cancion_slug" text NOT NULL,
|
||||
"titulo" text NOT NULL,
|
||||
CONSTRAINT "pedido_item_pedido_id_cancion_slug_pk" PRIMARY KEY("pedido_id","cancion_slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sesion" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"usuario_id" text NOT NULL,
|
||||
"expira_en" timestamp with time zone NOT NULL,
|
||||
"creada_en" timestamp with time zone NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "usuario" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"email" text NOT NULL,
|
||||
"nombre" text,
|
||||
"creado_en" timestamp with time zone NOT NULL,
|
||||
"ultimo_acceso_en" timestamp with time zone,
|
||||
CONSTRAINT "usuario_email_unique" UNIQUE("email")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "valoracion" (
|
||||
"usuario_id" text NOT NULL,
|
||||
"cancion_slug" text NOT NULL,
|
||||
"puntuacion" integer NOT NULL,
|
||||
"creada_en" timestamp with time zone NOT NULL,
|
||||
"actualizada_en" timestamp with time zone NOT NULL,
|
||||
CONSTRAINT "valoracion_usuario_id_cancion_slug_pk" PRIMARY KEY("usuario_id","cancion_slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "carrito" ADD CONSTRAINT "carrito_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "carrito_item" ADD CONSTRAINT "carrito_item_carrito_id_carrito_id_fk" FOREIGN KEY ("carrito_id") REFERENCES "public"."carrito"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "compra" ADD CONSTRAINT "compra_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "compra" ADD CONSTRAINT "compra_pedido_id_pedido_id_fk" FOREIGN KEY ("pedido_id") REFERENCES "public"."pedido"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "favorito" ADD CONSTRAINT "favorito_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "pedido" ADD CONSTRAINT "pedido_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "pedido_item" ADD CONSTRAINT "pedido_item_pedido_id_pedido_id_fk" FOREIGN KEY ("pedido_id") REFERENCES "public"."pedido"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "sesion" ADD CONSTRAINT "sesion_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "valoracion" ADD CONSTRAINT "valoracion_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "carrito_usuario" ON "carrito" USING btree ("usuario_id");--> statement-breakpoint
|
||||
CREATE INDEX "codigo_acceso_email" ON "codigo_acceso" USING btree ("email");--> statement-breakpoint
|
||||
CREATE INDEX "idx_favorito_usuario" ON "favorito" USING btree ("usuario_id");--> statement-breakpoint
|
||||
CREATE INDEX "limite_expira" ON "limite" USING btree ("expira_en");--> statement-breakpoint
|
||||
CREATE INDEX "pedido_usuario" ON "pedido" USING btree ("usuario_id");--> statement-breakpoint
|
||||
CREATE INDEX "sesion_usuario" ON "sesion" USING btree ("usuario_id");--> statement-breakpoint
|
||||
CREATE INDEX "idx_valoracion_cancion" ON "valoracion" USING btree ("cancion_slug");
|
||||
@ -1,79 +0,0 @@
|
||||
CREATE TABLE `carrito` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`usuario_id` text,
|
||||
`creado_en` integer NOT NULL,
|
||||
`actualizado_en` integer NOT NULL,
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `carrito_usuario` ON `carrito` (`usuario_id`);--> statement-breakpoint
|
||||
CREATE TABLE `carrito_item` (
|
||||
`carrito_id` text NOT NULL,
|
||||
`cancion_slug` text NOT NULL,
|
||||
`anadido_en` integer NOT NULL,
|
||||
PRIMARY KEY(`carrito_id`, `cancion_slug`),
|
||||
FOREIGN KEY (`carrito_id`) REFERENCES `carrito`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `codigo_acceso` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`email` text NOT NULL,
|
||||
`hash` text NOT NULL,
|
||||
`expira_en` integer NOT NULL,
|
||||
`intentos` integer DEFAULT 0 NOT NULL,
|
||||
`usado_en` integer,
|
||||
`creado_en` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `codigo_acceso_email` ON `codigo_acceso` (`email`);--> statement-breakpoint
|
||||
CREATE TABLE `compra` (
|
||||
`usuario_id` text NOT NULL,
|
||||
`cancion_slug` text NOT NULL,
|
||||
`pedido_id` text NOT NULL,
|
||||
`comprado_en` integer NOT NULL,
|
||||
PRIMARY KEY(`usuario_id`, `cancion_slug`),
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`pedido_id`) REFERENCES `pedido`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `pedido` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`usuario_id` text NOT NULL,
|
||||
`sesion_pago_id` text NOT NULL,
|
||||
`estado` text DEFAULT 'pendiente' NOT NULL,
|
||||
`packs` integer NOT NULL,
|
||||
`total_centimos` integer NOT NULL,
|
||||
`moneda` text DEFAULT 'eur' NOT NULL,
|
||||
`creado_en` integer NOT NULL,
|
||||
`pagado_en` integer,
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `pedido_sesion_pago_id_unique` ON `pedido` (`sesion_pago_id`);--> statement-breakpoint
|
||||
CREATE INDEX `pedido_usuario` ON `pedido` (`usuario_id`);--> statement-breakpoint
|
||||
CREATE TABLE `pedido_item` (
|
||||
`pedido_id` text NOT NULL,
|
||||
`cancion_slug` text NOT NULL,
|
||||
`titulo` text NOT NULL,
|
||||
PRIMARY KEY(`pedido_id`, `cancion_slug`),
|
||||
FOREIGN KEY (`pedido_id`) REFERENCES `pedido`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `sesion` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`usuario_id` text NOT NULL,
|
||||
`expira_en` integer NOT NULL,
|
||||
`creada_en` integer NOT NULL,
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `sesion_usuario` ON `sesion` (`usuario_id`);--> statement-breakpoint
|
||||
CREATE TABLE `usuario` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`email` text NOT NULL,
|
||||
`nombre` text,
|
||||
`creado_en` integer NOT NULL,
|
||||
`ultimo_acceso_en` integer
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `usuario_email_unique` ON `usuario` (`email`);
|
||||
@ -1,7 +0,0 @@
|
||||
CREATE TABLE `limite` (
|
||||
`clave` text PRIMARY KEY NOT NULL,
|
||||
`intentos` integer NOT NULL,
|
||||
`expira_en` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `limite_expira` ON `limite` (`expira_en`);
|
||||
@ -1,11 +0,0 @@
|
||||
CREATE TABLE `valoracion` (
|
||||
`usuario_id` text NOT NULL,
|
||||
`cancion_slug` text NOT NULL,
|
||||
`puntuacion` integer NOT NULL,
|
||||
`creada_en` integer NOT NULL,
|
||||
`actualizada_en` integer NOT NULL,
|
||||
PRIMARY KEY(`usuario_id`, `cancion_slug`),
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `idx_valoracion_cancion` ON `valoracion` (`cancion_slug`);
|
||||
@ -1,9 +0,0 @@
|
||||
CREATE TABLE `favorito` (
|
||||
`usuario_id` text NOT NULL,
|
||||
`cancion_slug` text NOT NULL,
|
||||
`marcado_en` integer NOT NULL,
|
||||
PRIMARY KEY(`usuario_id`, `cancion_slug`),
|
||||
FOREIGN KEY (`usuario_id`) REFERENCES `usuario`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `idx_favorito_usuario` ON `favorito` (`usuario_id`);
|
||||
@ -1,581 +0,0 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "7662184c-1b15-413a-8519-dc445f9e1d9d",
|
||||
"prevId": "375db306-e08d-48ac-910e-912f1c38c7e5",
|
||||
"tables": {
|
||||
"carrito": {
|
||||
"name": "carrito",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"actualizado_en": {
|
||||
"name": "actualizado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"carrito_usuario": {
|
||||
"name": "carrito_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"carrito_item": {
|
||||
"name": "carrito_item",
|
||||
"columns": {
|
||||
"carrito_id": {
|
||||
"name": "carrito_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"anadido_en": {
|
||||
"name": "anadido_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"carrito_item_carrito_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"carrito_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "carrito_item_carrito_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"codigo_acceso": {
|
||||
"name": "codigo_acceso",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"hash": {
|
||||
"name": "hash",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": 0
|
||||
},
|
||||
"usado_en": {
|
||||
"name": "usado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"codigo_acceso_email": {
|
||||
"name": "codigo_acceso_email",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"compra": {
|
||||
"name": "compra",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"comprado_en": {
|
||||
"name": "comprado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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_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_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "compra_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"limite": {
|
||||
"name": "limite",
|
||||
"columns": {
|
||||
"clave": {
|
||||
"name": "clave",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"limite_expira": {
|
||||
"name": "limite_expira",
|
||||
"columns": [
|
||||
"expira_en"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido": {
|
||||
"name": "pedido",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"sesion_pago_id": {
|
||||
"name": "sesion_pago_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"estado": {
|
||||
"name": "estado",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'pendiente'"
|
||||
},
|
||||
"packs": {
|
||||
"name": "packs",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"total_centimos": {
|
||||
"name": "total_centimos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"moneda": {
|
||||
"name": "moneda",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'eur'"
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pagado_en": {
|
||||
"name": "pagado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"pedido_sesion_pago_id_unique": {
|
||||
"name": "pedido_sesion_pago_id_unique",
|
||||
"columns": [
|
||||
"sesion_pago_id"
|
||||
],
|
||||
"isUnique": true
|
||||
},
|
||||
"pedido_usuario": {
|
||||
"name": "pedido_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido_item": {
|
||||
"name": "pedido_item",
|
||||
"columns": {
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"titulo": {
|
||||
"name": "titulo",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"pedido_item_pedido_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"pedido_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "pedido_item_pedido_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"sesion": {
|
||||
"name": "sesion",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creada_en": {
|
||||
"name": "creada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"sesion_usuario": {
|
||||
"name": "sesion_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"usuario": {
|
||||
"name": "usuario",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"nombre": {
|
||||
"name": "nombre",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"ultimo_acceso_en": {
|
||||
"name": "ultimo_acceso_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"usuario_email_unique": {
|
||||
"name": "usuario_email_unique",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": true
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
@ -1,656 +0,0 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "451fba36-e77b-45fd-894c-a02c708cdcbf",
|
||||
"prevId": "7662184c-1b15-413a-8519-dc445f9e1d9d",
|
||||
"tables": {
|
||||
"carrito": {
|
||||
"name": "carrito",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"actualizado_en": {
|
||||
"name": "actualizado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"carrito_usuario": {
|
||||
"name": "carrito_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"carrito_item": {
|
||||
"name": "carrito_item",
|
||||
"columns": {
|
||||
"carrito_id": {
|
||||
"name": "carrito_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"anadido_en": {
|
||||
"name": "anadido_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"carrito_item_carrito_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"carrito_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "carrito_item_carrito_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"codigo_acceso": {
|
||||
"name": "codigo_acceso",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"hash": {
|
||||
"name": "hash",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": 0
|
||||
},
|
||||
"usado_en": {
|
||||
"name": "usado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"codigo_acceso_email": {
|
||||
"name": "codigo_acceso_email",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"compra": {
|
||||
"name": "compra",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"comprado_en": {
|
||||
"name": "comprado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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_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_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "compra_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"limite": {
|
||||
"name": "limite",
|
||||
"columns": {
|
||||
"clave": {
|
||||
"name": "clave",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"limite_expira": {
|
||||
"name": "limite_expira",
|
||||
"columns": [
|
||||
"expira_en"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido": {
|
||||
"name": "pedido",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"sesion_pago_id": {
|
||||
"name": "sesion_pago_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"estado": {
|
||||
"name": "estado",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'pendiente'"
|
||||
},
|
||||
"packs": {
|
||||
"name": "packs",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"total_centimos": {
|
||||
"name": "total_centimos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"moneda": {
|
||||
"name": "moneda",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'eur'"
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pagado_en": {
|
||||
"name": "pagado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"pedido_sesion_pago_id_unique": {
|
||||
"name": "pedido_sesion_pago_id_unique",
|
||||
"columns": [
|
||||
"sesion_pago_id"
|
||||
],
|
||||
"isUnique": true
|
||||
},
|
||||
"pedido_usuario": {
|
||||
"name": "pedido_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido_item": {
|
||||
"name": "pedido_item",
|
||||
"columns": {
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"titulo": {
|
||||
"name": "titulo",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"pedido_item_pedido_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"pedido_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "pedido_item_pedido_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"sesion": {
|
||||
"name": "sesion",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creada_en": {
|
||||
"name": "creada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"sesion_usuario": {
|
||||
"name": "sesion_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"usuario": {
|
||||
"name": "usuario",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"nombre": {
|
||||
"name": "nombre",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"ultimo_acceso_en": {
|
||||
"name": "ultimo_acceso_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"usuario_email_unique": {
|
||||
"name": "usuario_email_unique",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": true
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"valoracion": {
|
||||
"name": "valoracion",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"puntuacion": {
|
||||
"name": "puntuacion",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creada_en": {
|
||||
"name": "creada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"actualizada_en": {
|
||||
"name": "actualizada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"idx_valoracion_cancion": {
|
||||
"name": "idx_valoracion_cancion",
|
||||
"columns": [
|
||||
"cancion_slug"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"valoracion_usuario_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "valoracion_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
@ -1,717 +0,0 @@
|
||||
{
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "49a154bc-fef2-4fec-9138-9a9d3ae97f42",
|
||||
"prevId": "451fba36-e77b-45fd-894c-a02c708cdcbf",
|
||||
"tables": {
|
||||
"carrito": {
|
||||
"name": "carrito",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"actualizado_en": {
|
||||
"name": "actualizado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"carrito_usuario": {
|
||||
"name": "carrito_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"carrito_item": {
|
||||
"name": "carrito_item",
|
||||
"columns": {
|
||||
"carrito_id": {
|
||||
"name": "carrito_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"anadido_en": {
|
||||
"name": "anadido_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"carrito_item_carrito_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"carrito_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "carrito_item_carrito_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"codigo_acceso": {
|
||||
"name": "codigo_acceso",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"hash": {
|
||||
"name": "hash",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": 0
|
||||
},
|
||||
"usado_en": {
|
||||
"name": "usado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"codigo_acceso_email": {
|
||||
"name": "codigo_acceso_email",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"compra": {
|
||||
"name": "compra",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"comprado_en": {
|
||||
"name": "comprado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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_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_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "compra_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"favorito": {
|
||||
"name": "favorito",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"marcado_en": {
|
||||
"name": "marcado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"idx_favorito_usuario": {
|
||||
"name": "idx_favorito_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"favorito_usuario_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "favorito_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"limite": {
|
||||
"name": "limite",
|
||||
"columns": {
|
||||
"clave": {
|
||||
"name": "clave",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"intentos": {
|
||||
"name": "intentos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"limite_expira": {
|
||||
"name": "limite_expira",
|
||||
"columns": [
|
||||
"expira_en"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido": {
|
||||
"name": "pedido",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"sesion_pago_id": {
|
||||
"name": "sesion_pago_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"estado": {
|
||||
"name": "estado",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'pendiente'"
|
||||
},
|
||||
"packs": {
|
||||
"name": "packs",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"total_centimos": {
|
||||
"name": "total_centimos",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"moneda": {
|
||||
"name": "moneda",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'eur'"
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"pagado_en": {
|
||||
"name": "pagado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"pedido_sesion_pago_id_unique": {
|
||||
"name": "pedido_sesion_pago_id_unique",
|
||||
"columns": [
|
||||
"sesion_pago_id"
|
||||
],
|
||||
"isUnique": true
|
||||
},
|
||||
"pedido_usuario": {
|
||||
"name": "pedido_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"pedido_item": {
|
||||
"name": "pedido_item",
|
||||
"columns": {
|
||||
"pedido_id": {
|
||||
"name": "pedido_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"titulo": {
|
||||
"name": "titulo",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"pedido_item_pedido_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"pedido_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "pedido_item_pedido_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"sesion": {
|
||||
"name": "sesion",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"expira_en": {
|
||||
"name": "expira_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creada_en": {
|
||||
"name": "creada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"sesion_usuario": {
|
||||
"name": "sesion_usuario",
|
||||
"columns": [
|
||||
"usuario_id"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"usuario": {
|
||||
"name": "usuario",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"email": {
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"nombre": {
|
||||
"name": "nombre",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creado_en": {
|
||||
"name": "creado_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"ultimo_acceso_en": {
|
||||
"name": "ultimo_acceso_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"usuario_email_unique": {
|
||||
"name": "usuario_email_unique",
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"isUnique": true
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
},
|
||||
"valoracion": {
|
||||
"name": "valoracion",
|
||||
"columns": {
|
||||
"usuario_id": {
|
||||
"name": "usuario_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"cancion_slug": {
|
||||
"name": "cancion_slug",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"puntuacion": {
|
||||
"name": "puntuacion",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"creada_en": {
|
||||
"name": "creada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"actualizada_en": {
|
||||
"name": "actualizada_en",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"idx_valoracion_cancion": {
|
||||
"name": "idx_valoracion_cancion",
|
||||
"columns": [
|
||||
"cancion_slug"
|
||||
],
|
||||
"isUnique": false
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {
|
||||
"valoracion_usuario_id_cancion_slug_pk": {
|
||||
"columns": [
|
||||
"usuario_id",
|
||||
"cancion_slug"
|
||||
],
|
||||
"name": "valoracion_usuario_id_cancion_slug_pk"
|
||||
}
|
||||
},
|
||||
"uniqueConstraints": {},
|
||||
"checkConstraints": {}
|
||||
}
|
||||
},
|
||||
"views": {},
|
||||
"enums": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
"columns": {}
|
||||
},
|
||||
"internal": {
|
||||
"indexes": {}
|
||||
}
|
||||
}
|
||||
@ -1,33 +1,12 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "sqlite",
|
||||
"dialect": "postgresql",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "6",
|
||||
"when": 1788645291369,
|
||||
"tag": "0000_good_magma",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "6",
|
||||
"when": 1788708006540,
|
||||
"tag": "0001_ancient_goblin_queen",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "6",
|
||||
"when": 1788727806327,
|
||||
"tag": "0002_common_jean_grey",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "6",
|
||||
"when": 1788730784535,
|
||||
"tag": "0003_dark_mad_thinker",
|
||||
"version": "7",
|
||||
"when": 1788780351154,
|
||||
"tag": "0000_aromatic_bug",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
@ -1,10 +1,25 @@
|
||||
import { drizzle } from 'drizzle-orm/libsql';
|
||||
import { createClient } from '@libsql/client';
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import pg from 'pg';
|
||||
import * as schema from './schema';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
|
||||
|
||||
const client = createClient({ url: env.DATABASE_URL });
|
||||
/**
|
||||
* Un pool, no una conexion suelta.
|
||||
*
|
||||
* El servidor atiende varias peticiones a la vez y cada una consulta lo suyo;
|
||||
* con una sola conexion se pondrian en fila. El pool las reparte y reutiliza,
|
||||
* que es lo que hace que abrir una pagina no espere a la anterior.
|
||||
*
|
||||
* `max` deliberadamente bajo: Postgres cobra caro cada conexion —cada una es un
|
||||
* proceso— y este sitio no necesita mas. Subirlo sin medir suele empeorar.
|
||||
*/
|
||||
const pool = new pg.Pool({
|
||||
connectionString: env.DATABASE_URL,
|
||||
max: 10,
|
||||
idleTimeoutMillis: 30_000,
|
||||
connectionTimeoutMillis: 10_000
|
||||
});
|
||||
|
||||
export const db = drizzle(client, { schema });
|
||||
export const db = drizzle(pool, { schema });
|
||||
|
||||
Loading…
Reference in new issue