From a55b5b91044c9d4d8aa374cc3a63c307bac2c641 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 28 Dec 2023 20:52:30 -0300 Subject: [PATCH] separar migraciones a varios archivos aparentemente las migraciones de drizzle-kit con bun no soportan varios statement --- db-datos/drizzle/0004_left_wolfsbane.sql | 14 --- db-datos/drizzle/0005_lucky_epoch.sql | 2 + db-datos/drizzle/0006_jazzy_madripoor.sql | 7 ++ db-datos/drizzle/0007_bright_silvermane.sql | 6 ++ db-datos/drizzle/0008_funny_nighthawk.sql | 8 ++ db-datos/drizzle/meta/0005_snapshot.json | 101 ++++++++++++++++++++ db-datos/drizzle/meta/0006_snapshot.json | 101 ++++++++++++++++++++ db-datos/drizzle/meta/0007_snapshot.json | 101 ++++++++++++++++++++ db-datos/drizzle/meta/0008_snapshot.json | 101 ++++++++++++++++++++ db-datos/drizzle/meta/_journal.json | 28 ++++++ 10 files changed, 455 insertions(+), 14 deletions(-) create mode 100644 db-datos/drizzle/0005_lucky_epoch.sql create mode 100644 db-datos/drizzle/0006_jazzy_madripoor.sql create mode 100644 db-datos/drizzle/0007_bright_silvermane.sql create mode 100644 db-datos/drizzle/0008_funny_nighthawk.sql create mode 100644 db-datos/drizzle/meta/0005_snapshot.json create mode 100644 db-datos/drizzle/meta/0006_snapshot.json create mode 100644 db-datos/drizzle/meta/0007_snapshot.json create mode 100644 db-datos/drizzle/meta/0008_snapshot.json diff --git a/db-datos/drizzle/0004_left_wolfsbane.sql b/db-datos/drizzle/0004_left_wolfsbane.sql index 9fb754b..4ac6f25 100644 --- a/db-datos/drizzle/0004_left_wolfsbane.sql +++ b/db-datos/drizzle/0004_left_wolfsbane.sql @@ -1,17 +1,3 @@ -- Custom SQL migration file, put you code below! -- create virtual table precios_fts using fts5(ean, url, name, content=precios, content_rowid=id); -insert into precios_fts(rowid,ean,url,name) select id,ean,url,name from precios; - --- https://sqlite.org/fts5.html#external_content_and_contentless_tables --- Triggers to keep the FTS index up to date. -CREATE TRIGGER precios_fts_ai AFTER INSERT ON precios BEGIN - INSERT INTO precios_fts(rowid, ean, url, name) VALUES (new.id, new.ean, new.url, new.name); -END; -CREATE TRIGGER precios_fts_ad AFTER DELETE ON precios BEGIN - INSERT INTO precios_fts(precios_fts, rowid, ean, url, name) VALUES('delete', old.id, old.ean, old.url, old.name); -END; -CREATE TRIGGER precios_fts_au AFTER UPDATE ON precios BEGIN - INSERT INTO precios_fts(precios_fts, rowid, ean, url, name) VALUES('delete', old.id, old.ean, old.url, old.name); - INSERT INTO precios_fts(rowid, ean, url, name) VALUES (new.id, new.ean, new.url, new.name); -END; diff --git a/db-datos/drizzle/0005_lucky_epoch.sql b/db-datos/drizzle/0005_lucky_epoch.sql new file mode 100644 index 0000000..502d107 --- /dev/null +++ b/db-datos/drizzle/0005_lucky_epoch.sql @@ -0,0 +1,2 @@ +-- Custom SQL migration file, put you code below! -- +insert into precios_fts(rowid,ean,url,name) select id,ean,url,name from precios; diff --git a/db-datos/drizzle/0006_jazzy_madripoor.sql b/db-datos/drizzle/0006_jazzy_madripoor.sql new file mode 100644 index 0000000..09d4a48 --- /dev/null +++ b/db-datos/drizzle/0006_jazzy_madripoor.sql @@ -0,0 +1,7 @@ +-- Custom SQL migration file, put you code below! -- + +-- https://sqlite.org/fts5.html#external_content_and_contentless_tables +-- Triggers to keep the FTS index up to date. +CREATE TRIGGER precios_fts_ai AFTER INSERT ON precios BEGIN + INSERT INTO precios_fts(rowid, ean, url, name) VALUES (new.id, new.ean, new.url, new.name); +END; diff --git a/db-datos/drizzle/0007_bright_silvermane.sql b/db-datos/drizzle/0007_bright_silvermane.sql new file mode 100644 index 0000000..8f8e6e9 --- /dev/null +++ b/db-datos/drizzle/0007_bright_silvermane.sql @@ -0,0 +1,6 @@ +-- Custom SQL migration file, put you code below! -- +-- https://sqlite.org/fts5.html#external_content_and_contentless_tables +-- Triggers to keep the FTS index up to date. +CREATE TRIGGER precios_fts_ad AFTER DELETE ON precios BEGIN + INSERT INTO precios_fts(precios_fts, rowid, ean, url, name) VALUES('delete', old.id, old.ean, old.url, old.name); +END; \ No newline at end of file diff --git a/db-datos/drizzle/0008_funny_nighthawk.sql b/db-datos/drizzle/0008_funny_nighthawk.sql new file mode 100644 index 0000000..003ce44 --- /dev/null +++ b/db-datos/drizzle/0008_funny_nighthawk.sql @@ -0,0 +1,8 @@ +-- Custom SQL migration file, put you code below! -- + +-- https://sqlite.org/fts5.html#external_content_and_contentless_tables +-- Triggers to keep the FTS index up to date. +CREATE TRIGGER precios_fts_au AFTER UPDATE ON precios BEGIN + INSERT INTO precios_fts(precios_fts, rowid, ean, url, name) VALUES('delete', old.id, old.ean, old.url, old.name); + INSERT INTO precios_fts(rowid, ean, url, name) VALUES (new.id, new.ean, new.url, new.name); +END; diff --git a/db-datos/drizzle/meta/0005_snapshot.json b/db-datos/drizzle/meta/0005_snapshot.json new file mode 100644 index 0000000..6c8f4eb --- /dev/null +++ b/db-datos/drizzle/meta/0005_snapshot.json @@ -0,0 +1,101 @@ +{ + "id": "f2cf47b9-e137-41c9-b7fb-6bc016588db0", + "prevId": "bf90a1cd-ae6a-4dba-a1aa-79f14a11d958", + "version": "5", + "dialect": "sqlite", + "tables": { + "precios": { + "name": "precios", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "precio_centavos": { + "name": "precio_centavos", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "in_stock": { + "name": "in_stock", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "warc_record_id": { + "name": "warc_record_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parser_version": { + "name": "parser_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "precios_ean_idx": { + "name": "precios_ean_idx", + "columns": [ + "ean" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db-datos/drizzle/meta/0006_snapshot.json b/db-datos/drizzle/meta/0006_snapshot.json new file mode 100644 index 0000000..91264b9 --- /dev/null +++ b/db-datos/drizzle/meta/0006_snapshot.json @@ -0,0 +1,101 @@ +{ + "id": "ac099405-ecd0-4637-ae5e-fb29c9847e45", + "prevId": "f2cf47b9-e137-41c9-b7fb-6bc016588db0", + "version": "5", + "dialect": "sqlite", + "tables": { + "precios": { + "name": "precios", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "precio_centavos": { + "name": "precio_centavos", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "in_stock": { + "name": "in_stock", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "warc_record_id": { + "name": "warc_record_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parser_version": { + "name": "parser_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "precios_ean_idx": { + "name": "precios_ean_idx", + "columns": [ + "ean" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db-datos/drizzle/meta/0007_snapshot.json b/db-datos/drizzle/meta/0007_snapshot.json new file mode 100644 index 0000000..393af02 --- /dev/null +++ b/db-datos/drizzle/meta/0007_snapshot.json @@ -0,0 +1,101 @@ +{ + "id": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25", + "prevId": "ac099405-ecd0-4637-ae5e-fb29c9847e45", + "version": "5", + "dialect": "sqlite", + "tables": { + "precios": { + "name": "precios", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "precio_centavos": { + "name": "precio_centavos", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "in_stock": { + "name": "in_stock", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "warc_record_id": { + "name": "warc_record_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parser_version": { + "name": "parser_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "precios_ean_idx": { + "name": "precios_ean_idx", + "columns": [ + "ean" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db-datos/drizzle/meta/0008_snapshot.json b/db-datos/drizzle/meta/0008_snapshot.json new file mode 100644 index 0000000..b94b439 --- /dev/null +++ b/db-datos/drizzle/meta/0008_snapshot.json @@ -0,0 +1,101 @@ +{ + "id": "082630a9-3744-4e33-bde5-06045ca57d36", + "prevId": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25", + "version": "5", + "dialect": "sqlite", + "tables": { + "precios": { + "name": "precios", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "precio_centavos": { + "name": "precio_centavos", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "in_stock": { + "name": "in_stock", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "warc_record_id": { + "name": "warc_record_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parser_version": { + "name": "parser_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "precios_ean_idx": { + "name": "precios_ean_idx", + "columns": [ + "ean" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db-datos/drizzle/meta/_journal.json b/db-datos/drizzle/meta/_journal.json index 32e5cc7..a9d231b 100644 --- a/db-datos/drizzle/meta/_journal.json +++ b/db-datos/drizzle/meta/_journal.json @@ -36,6 +36,34 @@ "when": 1703726748364, "tag": "0004_left_wolfsbane", "breakpoints": true + }, + { + "idx": 5, + "version": "5", + "when": 1703807455551, + "tag": "0005_lucky_epoch", + "breakpoints": true + }, + { + "idx": 6, + "version": "5", + "when": 1703807457204, + "tag": "0006_jazzy_madripoor", + "breakpoints": true + }, + { + "idx": 7, + "version": "5", + "when": 1703807458666, + "tag": "0007_bright_silvermane", + "breakpoints": true + }, + { + "idx": 8, + "version": "5", + "when": 1703807460152, + "tag": "0008_funny_nighthawk", + "breakpoints": true } ] } \ No newline at end of file