From 41694b7c32df377dafe477e5a4576d990da6d4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arwid=20Thornstr=C3=B6m?= Date: Thu, 3 Apr 2025 11:22:42 +0200 Subject: [PATCH] added temporary category updated table (#468) * added temporary category updated table * added more * added keyword columns * correct migration number * updated from feedback --- migrations/000.544.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 migrations/000.544.sql diff --git a/migrations/000.544.sql b/migrations/000.544.sql new file mode 100644 index 0000000..22c9ea2 --- /dev/null +++ b/migrations/000.544.sql @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS category_texts_updated CASCADE; +CREATE TABLE category_texts_updated ( + id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + category_texts_id INT NOT NULL REFERENCES category_texts(id) ON DELETE CASCADE, + product_type VARCHAR(255) NOT NULL, + updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT unique_category_text_product UNIQUE (category_texts_id, product_type) +); + +-- Create indexes for better query performance +CREATE INDEX idx_category_texts_updated_category_texts_id ON category_texts_updated(category_texts_id); +CREATE INDEX idx_category_texts_updated_product_type ON category_texts_updated(product_type); + +-- Update the category_texts to have the new text_length column +ALTER TABLE category_texts ADD COLUMN text_length TEXT DEFAULT 'short'; + +-- Then insert short or long for each active category +UPDATE category_texts SET text_length = 'long' WHERE category_id IN (3, 5, 9, 11, 13, 15, 17, 19, 23, 27, 29, 45, 47, 49, 61, 63, 65, 73, 75, 81, 83, 87, 89, 91, 93, 95, 97, 99, 101, 103, 109, 111, 117, 119, 123, 127, 129, 131, 133, 135, 137, 139, 141, 149, 151, 157, 167, 169, 179, 183, 213, 219, 223, 233, 239, 243, 249, 255, 259, 261, 265, 267, 271, 273, 275, 277, 279, 281, 283, 285, 287, 295, 299, 303, 305, 307, 309, 311, 313, 315, 317, 323, 325, 327, 333, 335, 337, 339, 343, 345, 347, 349, 353, 355, 357, 361, 363, 365, 367, 369, 371, 375, 379, 385, 387, 389, 391, 395, 397, 399, 401, 405, 407, 409, 411, 413, 417, 419, 421, 423, 425, 427, 431, 433, 435, 437, 439, 441, 443, 447, 449, 451, 455, 457, 459, 463, 465, 471, 473, 475, 481, 485, 489, 491, 493, 499, 501, 507, 509, 539, 543, 547, 553, 563, 565, 567, 573, 575, 577, 599, 609, 611, 657, 661, 665, 667, 669, 675, 685, 689, 693, 701, 703, 707, 709, 711, 715, 717, 723, 725, 737, 739, 741, 747, 749, 759, 763, 765, 767, 769, 777, 783, 785, 787, 801, 805, 807, 809, 821, 823, 825, 827, 829, 831, 835, 839, 851, 857, 859, 861, 863, 891, 929, 931, 957, 969, 971, 973, 975, 983, 985, 987, 989, 993, 995, 997, 1005, 1011, 1015, 1017, 1019, 1025, 1029, 1031, 1035, 1039, 1041, 1043, 1049, 1051, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1075, 1081, 1089, 1091, 1093, 1095, 1107, 1111, 1133, 1135, 1137, 1141, 1143, 1145, 1147, 1153, 1165, 1167, 1169, 1175, 1177, 1179, 1183, 1191, 1193, 1195, 1199, 1205, 1207, 1211, 1217, 1233, 1235, 1237, 1239, 1249, 1251, 1261, 1265, 1273, 1275, 1277, 1279, 1281, 1283, 1285, 1287, 1289, 1303, 1315, 1327, 1329, 1331, 1333, 1335, 1339, 1345, 1347, 1355, 1357, 1373, 1375, 1377, 1379, 1381, 1383, 1389, 1391, 1395, 1399, 1401, 1403, 1405, 1409, 1413, 1415, 1417, 1419, 1423, 1425, 1427, 1431, 1433, 1435, 1437, 1439, 1441, 1447, 1449, 1451, 1453, 1455, 1457, 1459, 1461, 1463, 1465, 1467, 1469, 1471, 1473, 1475, 1477, 1479, 1483, 1485, 1487, 1489, 1491, 1493, 1503, 1505, 1507, 1509, 1511, 1513, 1515, 1517, 1521, 1523, 1525, 1527, 1529, 1533, 1535, 1537, 1539, 1545, 1547, 1549, 1555, 1557, 1559, 1561, 1563, 1565, 1567, 1569, 1571, 1573, 1577, 1587, 1589, 1597, 1599, 1605, 1617, 1621, 1623, 1625, 1627, 1633, 1635, 1653, 1655, 1657, 1659, 1663, 1665, 1667, 1669, 1673, 1675, 1677, 1679, 1709, 1725, 1727, 1771); + +ALTER TABLE category_texts ADD COLUMN wallpaper_keywords text[]; +ALTER TABLE category_texts ADD COLUMN design_wallpaper_keywords text[]; +ALTER TABLE category_texts ADD COLUMN canvas_keywords text[]; +ALTER TABLE category_texts ADD COLUMN poster_keywords text[];