From 8617a0b2a56352c8d84cf16a6534ece26e2cd730 Mon Sep 17 00:00:00 2001 From: Nulo Date: Sun, 4 Aug 2024 15:35:43 -0300 Subject: [PATCH] index ean, fetched_at --- db-datos/drizzle/0013_harsh_starbolt.sql | 1 + db-datos/drizzle/meta/0000_snapshot.json | 9 +- db-datos/drizzle/meta/0001_snapshot.json | 9 +- db-datos/drizzle/meta/0002_snapshot.json | 9 +- db-datos/drizzle/meta/0003_snapshot.json | 9 +- db-datos/drizzle/meta/0004_snapshot.json | 13 +- db-datos/drizzle/meta/0005_snapshot.json | 13 +- db-datos/drizzle/meta/0006_snapshot.json | 13 +- db-datos/drizzle/meta/0007_snapshot.json | 13 +- db-datos/drizzle/meta/0008_snapshot.json | 13 +- db-datos/drizzle/meta/0009_snapshot.json | 9 +- db-datos/drizzle/meta/0010_snapshot.json | 9 +- db-datos/drizzle/meta/0011_snapshot.json | 9 +- db-datos/drizzle/meta/0012_snapshot.json | 9 +- db-datos/drizzle/meta/0013_snapshot.json | 208 +++++++++++++++++++++++ db-datos/drizzle/meta/_journal.json | 7 + db-datos/package.json | 2 +- db-datos/schema.js | 4 + 18 files changed, 283 insertions(+), 76 deletions(-) create mode 100644 db-datos/drizzle/0013_harsh_starbolt.sql create mode 100644 db-datos/drizzle/meta/0013_snapshot.json diff --git a/db-datos/drizzle/0013_harsh_starbolt.sql b/db-datos/drizzle/0013_harsh_starbolt.sql new file mode 100644 index 0000000..581aee9 --- /dev/null +++ b/db-datos/drizzle/0013_harsh_starbolt.sql @@ -0,0 +1 @@ +CREATE INDEX `precios_ean_fetched_at_idx` ON `precios` (`ean`,`fetched_at`); \ No newline at end of file diff --git a/db-datos/drizzle/meta/0000_snapshot.json b/db-datos/drizzle/meta/0000_snapshot.json index 7670290..397433c 100644 --- a/db-datos/drizzle/meta/0000_snapshot.json +++ b/db-datos/drizzle/meta/0000_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "88aa0254-106e-424e-ab66-417ff44bbf0b", - "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "precios": { "name": "precios", @@ -58,8 +56,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "88aa0254-106e-424e-ab66-417ff44bbf0b", + "prevId": "00000000-0000-0000-0000-000000000000" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0001_snapshot.json b/db-datos/drizzle/meta/0001_snapshot.json index b39b90e..35ebfb3 100644 --- a/db-datos/drizzle/meta/0001_snapshot.json +++ b/db-datos/drizzle/meta/0001_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "a565621c-046e-4f4d-b505-104e2c4f2b6c", - "prevId": "88aa0254-106e-424e-ab66-417ff44bbf0b", "tables": { "precios": { "name": "precios", @@ -72,8 +70,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "a565621c-046e-4f4d-b505-104e2c4f2b6c", + "prevId": "88aa0254-106e-424e-ab66-417ff44bbf0b" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0002_snapshot.json b/db-datos/drizzle/meta/0002_snapshot.json index 8acddad..9ea24a7 100644 --- a/db-datos/drizzle/meta/0002_snapshot.json +++ b/db-datos/drizzle/meta/0002_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "cbd90a60-7568-489f-ac45-95bd8818ffbd", - "prevId": "a565621c-046e-4f4d-b505-104e2c4f2b6c", "tables": { "precios": { "name": "precios", @@ -86,8 +84,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "cbd90a60-7568-489f-ac45-95bd8818ffbd", + "prevId": "a565621c-046e-4f4d-b505-104e2c4f2b6c" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0003_snapshot.json b/db-datos/drizzle/meta/0003_snapshot.json index 582d5e2..a6f45bc 100644 --- a/db-datos/drizzle/meta/0003_snapshot.json +++ b/db-datos/drizzle/meta/0003_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "e1217fdb-6f54-44c5-a04b-c5aebf202102", - "prevId": "cbd90a60-7568-489f-ac45-95bd8818ffbd", "tables": { "precios": { "name": "precios", @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "e1217fdb-6f54-44c5-a04b-c5aebf202102", + "prevId": "cbd90a60-7568-489f-ac45-95bd8818ffbd" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0004_snapshot.json b/db-datos/drizzle/meta/0004_snapshot.json index 52e3adf..bb23c16 100644 --- a/db-datos/drizzle/meta/0004_snapshot.json +++ b/db-datos/drizzle/meta/0004_snapshot.json @@ -1,7 +1,5 @@ { - "id": "bf90a1cd-ae6a-4dba-a1aa-79f14a11d958", - "prevId": "e1217fdb-6f54-44c5-a04b-c5aebf202102", - "version": "5", + "version": "6", "dialect": "sqlite", "tables": { "precios": { @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } + "tables": {}, + "columns": {} + }, + "id": "bf90a1cd-ae6a-4dba-a1aa-79f14a11d958", + "prevId": "e1217fdb-6f54-44c5-a04b-c5aebf202102" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0005_snapshot.json b/db-datos/drizzle/meta/0005_snapshot.json index 6c8f4eb..4a0a507 100644 --- a/db-datos/drizzle/meta/0005_snapshot.json +++ b/db-datos/drizzle/meta/0005_snapshot.json @@ -1,7 +1,5 @@ { - "id": "f2cf47b9-e137-41c9-b7fb-6bc016588db0", - "prevId": "bf90a1cd-ae6a-4dba-a1aa-79f14a11d958", - "version": "5", + "version": "6", "dialect": "sqlite", "tables": { "precios": { @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } + "tables": {}, + "columns": {} + }, + "id": "f2cf47b9-e137-41c9-b7fb-6bc016588db0", + "prevId": "bf90a1cd-ae6a-4dba-a1aa-79f14a11d958" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0006_snapshot.json b/db-datos/drizzle/meta/0006_snapshot.json index 91264b9..a40df1c 100644 --- a/db-datos/drizzle/meta/0006_snapshot.json +++ b/db-datos/drizzle/meta/0006_snapshot.json @@ -1,7 +1,5 @@ { - "id": "ac099405-ecd0-4637-ae5e-fb29c9847e45", - "prevId": "f2cf47b9-e137-41c9-b7fb-6bc016588db0", - "version": "5", + "version": "6", "dialect": "sqlite", "tables": { "precios": { @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } + "tables": {}, + "columns": {} + }, + "id": "ac099405-ecd0-4637-ae5e-fb29c9847e45", + "prevId": "f2cf47b9-e137-41c9-b7fb-6bc016588db0" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0007_snapshot.json b/db-datos/drizzle/meta/0007_snapshot.json index 393af02..c46772e 100644 --- a/db-datos/drizzle/meta/0007_snapshot.json +++ b/db-datos/drizzle/meta/0007_snapshot.json @@ -1,7 +1,5 @@ { - "id": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25", - "prevId": "ac099405-ecd0-4637-ae5e-fb29c9847e45", - "version": "5", + "version": "6", "dialect": "sqlite", "tables": { "precios": { @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } + "tables": {}, + "columns": {} + }, + "id": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25", + "prevId": "ac099405-ecd0-4637-ae5e-fb29c9847e45" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0008_snapshot.json b/db-datos/drizzle/meta/0008_snapshot.json index b94b439..f1a975d 100644 --- a/db-datos/drizzle/meta/0008_snapshot.json +++ b/db-datos/drizzle/meta/0008_snapshot.json @@ -1,7 +1,5 @@ { - "id": "082630a9-3744-4e33-bde5-06045ca57d36", - "prevId": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25", - "version": "5", + "version": "6", "dialect": "sqlite", "tables": { "precios": { @@ -94,8 +92,9 @@ }, "enums": {}, "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } + "tables": {}, + "columns": {} + }, + "id": "082630a9-3744-4e33-bde5-06045ca57d36", + "prevId": "9d2f23bf-dc60-4adb-b1bd-ec75e90dda25" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0009_snapshot.json b/db-datos/drizzle/meta/0009_snapshot.json index 100a9ac..ebfb2f2 100644 --- a/db-datos/drizzle/meta/0009_snapshot.json +++ b/db-datos/drizzle/meta/0009_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "2e398920-ffaf-4d55-ae13-d906cb9e0efa", - "prevId": "082630a9-3744-4e33-bde5-06045ca57d36", "tables": { "precios": { "name": "precios", @@ -139,8 +137,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "2e398920-ffaf-4d55-ae13-d906cb9e0efa", + "prevId": "082630a9-3744-4e33-bde5-06045ca57d36" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0010_snapshot.json b/db-datos/drizzle/meta/0010_snapshot.json index d2a437e..6ff1ffc 100644 --- a/db-datos/drizzle/meta/0010_snapshot.json +++ b/db-datos/drizzle/meta/0010_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "c8297337-4ed8-432e-8782-65d41be42e00", - "prevId": "2e398920-ffaf-4d55-ae13-d906cb9e0efa", "tables": { "db_best_selling": { "name": "db_best_selling", @@ -176,8 +174,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "c8297337-4ed8-432e-8782-65d41be42e00", + "prevId": "2e398920-ffaf-4d55-ae13-d906cb9e0efa" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0011_snapshot.json b/db-datos/drizzle/meta/0011_snapshot.json index 9fc2714..830d701 100644 --- a/db-datos/drizzle/meta/0011_snapshot.json +++ b/db-datos/drizzle/meta/0011_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "8b4921b5-6ecd-4d69-ba64-9b0bfb53db84", - "prevId": "c8297337-4ed8-432e-8782-65d41be42e00", "tables": { "db_best_selling": { "name": "db_best_selling", @@ -183,8 +181,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "8b4921b5-6ecd-4d69-ba64-9b0bfb53db84", + "prevId": "c8297337-4ed8-432e-8782-65d41be42e00" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0012_snapshot.json b/db-datos/drizzle/meta/0012_snapshot.json index 1e90f1e..b986781 100644 --- a/db-datos/drizzle/meta/0012_snapshot.json +++ b/db-datos/drizzle/meta/0012_snapshot.json @@ -1,8 +1,6 @@ { - "version": "5", + "version": "6", "dialect": "sqlite", - "id": "16046188-ab24-4bd4-bfb4-8a81f24c6f28", - "prevId": "8b4921b5-6ecd-4d69-ba64-9b0bfb53db84", "tables": { "db_best_selling": { "name": "db_best_selling", @@ -190,8 +188,9 @@ }, "enums": {}, "_meta": { - "schemas": {}, "tables": {}, "columns": {} - } + }, + "id": "16046188-ab24-4bd4-bfb4-8a81f24c6f28", + "prevId": "8b4921b5-6ecd-4d69-ba64-9b0bfb53db84" } \ No newline at end of file diff --git a/db-datos/drizzle/meta/0013_snapshot.json b/db-datos/drizzle/meta/0013_snapshot.json new file mode 100644 index 0000000..09314d0 --- /dev/null +++ b/db-datos/drizzle/meta/0013_snapshot.json @@ -0,0 +1,208 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "c95c6547-d540-45cf-aa9d-9d828efb468e", + "prevId": "16046188-ab24-4bd4-bfb4-8a81f24c6f28", + "tables": { + "db_best_selling": { + "name": "db_best_selling", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "eans_json": { + "name": "eans_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "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 + }, + "precios_url_idx": { + "name": "precios_url_idx", + "columns": [ + "url" + ], + "isUnique": false + }, + "precios_fetched_at_idx": { + "name": "precios_fetched_at_idx", + "columns": [ + "fetched_at" + ], + "isUnique": false + }, + "precios_ean_fetched_at_idx": { + "name": "precios_ean_fetched_at_idx", + "columns": [ + "ean", + "fetched_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "producto_urls": { + "name": "producto_urls", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "first_seen": { + "name": "first_seen", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_seen": { + "name": "last_seen", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "producto_urls_url_unique": { + "name": "producto_urls_url_unique", + "columns": [ + "url" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/db-datos/drizzle/meta/_journal.json b/db-datos/drizzle/meta/_journal.json index efbed3d..bb832f2 100644 --- a/db-datos/drizzle/meta/_journal.json +++ b/db-datos/drizzle/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1719680946811, "tag": "0012_hard_red_wolf", "breakpoints": true + }, + { + "idx": 13, + "version": "6", + "when": 1722796469056, + "tag": "0013_harsh_starbolt", + "breakpoints": true } ] } \ No newline at end of file diff --git a/db-datos/package.json b/db-datos/package.json index 04d1387..ba978d3 100644 --- a/db-datos/package.json +++ b/db-datos/package.json @@ -5,7 +5,7 @@ "description": "", "main": "index.js", "scripts": { - "generate": "drizzle-kit generate:sqlite", + "generate": "drizzle-kit generate", "migrate": "node migrate-cli.js" }, "keywords": [], diff --git a/db-datos/schema.js b/db-datos/schema.js index 64e27ef..1550f7f 100644 --- a/db-datos/schema.js +++ b/db-datos/schema.js @@ -22,6 +22,10 @@ export const precios = sqliteTable( preciosFetchedAtIdx: index("precios_fetched_at_idx").on( precios.fetchedAt ), + preciosEanFetchedAtIdx: index("precios_ean_fetched_at_idx").on( + precios.ean, + precios.fetchedAt + ), }; } );