Quote SQL identifiers as best practice and to avoid any problem in the future
This commit is contained in:
parent
5e99371b39
commit
ebe0585a40
@ -1,62 +1,62 @@
|
||||
-- description: Database initialization
|
||||
-- FROM sqlite3 app.db .schema > init.sql with extra IF NOT EXISTS and transaction
|
||||
-- description: Original database initialization
|
||||
-- FROM sqlite3 app.db .schema > init.sql with extra IF NOT EXISTS, transaction and quotes
|
||||
BEGIN transaction;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wishlist (
|
||||
set_num TEXT,
|
||||
name TEXT,
|
||||
year INTEGER,
|
||||
theme_id INTEGER,
|
||||
num_parts INTEGER,
|
||||
set_img_url TEXT,
|
||||
set_url TEXT,
|
||||
last_modified_dt TEXT
|
||||
CREATE TABLE IF NOT EXISTS "wishlist" (
|
||||
"set_num" TEXT,
|
||||
"name" TEXT,
|
||||
"year" INTEGER,
|
||||
"theme_id" INTEGER,
|
||||
"num_parts" INTEGER,
|
||||
"set_img_url" TEXT,
|
||||
"set_url" TEXT,
|
||||
"last_modified_dt" TEXT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS sets (
|
||||
set_num TEXT,
|
||||
name TEXT,
|
||||
year INTEGER,
|
||||
theme_id INTEGER,
|
||||
num_parts INTEGER,
|
||||
set_img_url TEXT,
|
||||
set_url TEXT,
|
||||
last_modified_dt TEXT,
|
||||
mini_col BOOLEAN,
|
||||
set_check BOOLEAN,
|
||||
set_col BOOLEAN,
|
||||
u_id TEXT
|
||||
CREATE TABLE IF NOT EXISTS "sets" (
|
||||
"set_num" TEXT,
|
||||
"name" TEXT,
|
||||
"year" INTEGER,
|
||||
"theme_id" INTEGER,
|
||||
"num_parts" INTEGER,
|
||||
"set_img_url" TEXT,
|
||||
"set_url" TEXT,
|
||||
"last_modified_dt" TEXT,
|
||||
"mini_col" BOOLEAN,
|
||||
"set_check" BOOLEAN,
|
||||
"set_col" BOOLEAN,
|
||||
"u_id" TEXT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS inventory (
|
||||
set_num TEXT,
|
||||
id INTEGER,
|
||||
part_num TEXT,
|
||||
name TEXT,
|
||||
part_img_url TEXT,
|
||||
part_img_url_id TEXT,
|
||||
color_id INTEGER,
|
||||
color_name TEXT,
|
||||
quantity INTEGER,
|
||||
is_spare BOOLEAN,
|
||||
element_id INTEGER,
|
||||
u_id TEXT
|
||||
CREATE TABLE IF NOT EXISTS "inventory" (
|
||||
"set_num" TEXT,
|
||||
"id" INTEGER,
|
||||
"part_num" TEXT,
|
||||
"name" TEXT,
|
||||
"part_img_url" TEXT,
|
||||
"part_img_url_id" TEXT,
|
||||
"color_id" INTEGER,
|
||||
"color_name" TEXT,
|
||||
"quantity" INTEGER,
|
||||
"is_spare" BOOLEAN,
|
||||
"element_id" INTEGER,
|
||||
"u_id" TEXT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS minifigures (
|
||||
fig_num TEXT,
|
||||
set_num TEXT,
|
||||
name TEXT,
|
||||
quantity INTEGER,
|
||||
set_img_url TEXT,
|
||||
u_id TEXT
|
||||
CREATE TABLE IF NOT EXISTS "minifigures" (
|
||||
"fig_num" TEXT,
|
||||
"set_num" TEXT,
|
||||
"name" TEXT,
|
||||
"quantity" INTEGER,
|
||||
"set_img_url" TEXT,
|
||||
"u_id" TEXT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS missing (
|
||||
set_num TEXT,
|
||||
id INTEGER,
|
||||
part_num TEXT,
|
||||
part_img_url_id TEXT,
|
||||
color_id INTEGER,
|
||||
quantity INTEGER,
|
||||
element_id INTEGER,
|
||||
u_id TEXT
|
||||
CREATE TABLE IF NOT EXISTS "missing" (
|
||||
"set_num" TEXT,
|
||||
"id" INTEGER,
|
||||
"part_num" TEXT,
|
||||
"part_img_url_id" TEXT,
|
||||
"color_id" INTEGER,
|
||||
"quantity" INTEGER,
|
||||
"element_id" INTEGER,
|
||||
"u_id" TEXT
|
||||
);
|
||||
|
||||
COMMIT;
|
@ -6,8 +6,8 @@ PRAGMA journal_mode = WAL;
|
||||
BEGIN transaction;
|
||||
|
||||
-- Fix a bug where 'None' was inserted in missing instead of NULL
|
||||
UPDATE missing
|
||||
SET element_id = NULL
|
||||
WHERE element_id = 'None';
|
||||
UPDATE "missing"
|
||||
SET "element_id" = NULL
|
||||
WHERE "missing"."element_id" = 'None';
|
||||
|
||||
COMMIT;
|
@ -1,20 +1,20 @@
|
||||
SELECT
|
||||
minifigures.fig_num,
|
||||
minifigures.set_num,
|
||||
minifigures.name,
|
||||
minifigures.quantity,
|
||||
minifigures.set_img_url,
|
||||
minifigures.u_id,
|
||||
"minifigures"."fig_num",
|
||||
"minifigures"."set_num",
|
||||
"minifigures"."name",
|
||||
"minifigures"."quantity",
|
||||
"minifigures"."set_img_url",
|
||||
"minifigures"."u_id",
|
||||
{% block total_missing %}
|
||||
NULL AS total_missing, -- dummy for order: total_missing
|
||||
NULL AS "total_missing", -- dummy for order: total_missing
|
||||
{% endblock %}
|
||||
{% block total_quantity %}
|
||||
NULL AS total_quantity, -- dummy for order: total_quantity
|
||||
NULL AS "total_quantity", -- dummy for order: total_quantity
|
||||
{% endblock %}
|
||||
{% block total_sets %}
|
||||
NULL AS total_sets -- dummy for order: total_sets
|
||||
NULL AS "total_sets" -- dummy for order: total_sets
|
||||
{% endblock %}
|
||||
FROM minifigures
|
||||
FROM "minifigures"
|
||||
|
||||
{% block join %}{% endblock %}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
DELETE FROM minifigures
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
DELETE FROM "minifigures"
|
||||
WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id
|
@ -1,10 +1,10 @@
|
||||
INSERT INTO minifigures (
|
||||
fig_num,
|
||||
set_num,
|
||||
name,
|
||||
quantity,
|
||||
set_img_url,
|
||||
u_id
|
||||
INSERT INTO "minifigures" (
|
||||
"fig_num",
|
||||
"set_num",
|
||||
"name",
|
||||
"quantity",
|
||||
"set_img_url",
|
||||
"u_id"
|
||||
) VALUES (
|
||||
:fig_num,
|
||||
:set_num,
|
||||
|
@ -1,34 +1,34 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing_join.total, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing_join"."total", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_quantity %}
|
||||
SUM(IFNULL(minifigures.quantity, 0)) AS total_quantity,
|
||||
{% block "total_quantity" %}
|
||||
SUM(IFNULL("minifigures"."quantity", 0)) AS "total_quantity",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_sets %}
|
||||
COUNT(minifigures.set_num) AS total_sets
|
||||
COUNT("minifigures"."set_num") AS "total_sets"
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
-- LEFT JOIN + SELECT to avoid messing the total
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
set_num,
|
||||
u_id,
|
||||
SUM(quantity) AS total
|
||||
FROM missing
|
||||
"missing"."set_num",
|
||||
"missing"."u_id",
|
||||
SUM("missing"."quantity") AS total
|
||||
FROM "missing"
|
||||
GROUP BY
|
||||
set_num,
|
||||
u_id
|
||||
"missing"."set_num",
|
||||
"missing"."u_id"
|
||||
) missing_join
|
||||
ON minifigures.u_id IS NOT DISTINCT FROM missing_join.u_id
|
||||
AND minifigures.fig_num IS NOT DISTINCT FROM missing_join.set_num
|
||||
ON "minifigures"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id"
|
||||
AND "minifigures"."fig_num" IS NOT DISTINCT FROM "missing_join"."set_num"
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
minifigures.fig_num
|
||||
"minifigures"."fig_num"
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
AND set_num IS NOT DISTINCT FROM :set_num
|
||||
WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
AND "minifigures"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
{% endblock %}
|
||||
|
@ -1,17 +1,17 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON minifigures.fig_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND minifigures.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "minifigures"."fig_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "minifigures"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
minifigures.fig_num,
|
||||
minifigures.u_id
|
||||
"minifigures"."fig_num",
|
||||
"minifigures"."u_id"
|
||||
{% endblock %}
|
||||
|
@ -1,30 +1,30 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON minifigures.fig_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND minifigures.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "minifigures"."fig_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "minifigures"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE minifigures.fig_num IN (
|
||||
WHERE "minifigures"."fig_num" IN (
|
||||
SELECT
|
||||
missing.set_num
|
||||
FROM missing
|
||||
"missing"."set_num"
|
||||
FROM "missing"
|
||||
|
||||
WHERE missing.color_id IS NOT DISTINCT FROM :color_id
|
||||
AND missing.element_id IS NOT DISTINCT FROM :element_id
|
||||
AND missing.part_num IS NOT DISTINCT FROM :part_num
|
||||
WHERE "missing"."color_id" IS NOT DISTINCT FROM :color_id
|
||||
AND "missing"."element_id" IS NOT DISTINCT FROM :element_id
|
||||
AND "missing"."part_num" IS NOT DISTINCT FROM :part_num
|
||||
|
||||
GROUP BY missing.set_num
|
||||
GROUP BY "missing"."set_num"
|
||||
)
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
minifigures.fig_num
|
||||
"minifigures"."fig_num"
|
||||
{% endblock %}
|
||||
|
@ -1,24 +1,24 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block total_quantity %}
|
||||
SUM(minifigures.quantity) AS total_quantity,
|
||||
SUM("minifigures"."quantity") AS "total_quantity",
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE minifigures.fig_num IN (
|
||||
WHERE "minifigures"."fig_num" IN (
|
||||
SELECT
|
||||
inventory.set_num
|
||||
FROM inventory
|
||||
"inventory"."set_num"
|
||||
FROM "inventory"
|
||||
|
||||
WHERE inventory.color_id IS NOT DISTINCT FROM :color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM :element_id
|
||||
AND inventory.part_num IS NOT DISTINCT FROM :part_num
|
||||
WHERE "inventory"."color_id" IS NOT DISTINCT FROM :color_id
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id
|
||||
AND "inventory"."part_num" IS NOT DISTINCT FROM :part_num
|
||||
|
||||
GROUP BY inventory.set_num
|
||||
GROUP BY "inventory"."set_num"
|
||||
)
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
minifigures.fig_num
|
||||
"minifigures"."fig_num"
|
||||
{% endblock %}
|
||||
|
@ -1,38 +1,38 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing_join.total, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing_join"."total", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_quantity %}
|
||||
SUM(IFNULL(minifigures.quantity, 0)) AS total_quantity,
|
||||
SUM(IFNULL("minifigures"."quantity", 0)) AS "total_quantity",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_sets %}
|
||||
COUNT(minifigures.set_num) AS total_sets
|
||||
COUNT("minifigures"."set_num") AS "total_sets"
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
-- LEFT JOIN + SELECT to avoid messing the total
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
set_num,
|
||||
u_id,
|
||||
SUM(quantity) AS total
|
||||
FROM missing
|
||||
"missing"."set_num",
|
||||
"missing"."u_id",
|
||||
SUM("missing"."quantity") AS "total"
|
||||
FROM "missing"
|
||||
GROUP BY
|
||||
set_num,
|
||||
u_id
|
||||
) missing_join
|
||||
ON minifigures.u_id IS NOT DISTINCT FROM missing_join.u_id
|
||||
AND minifigures.fig_num IS NOT DISTINCT FROM missing_join.set_num
|
||||
"missing"."set_num",
|
||||
"missing"."u_id"
|
||||
) "missing_join"
|
||||
ON "minifigures"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id"
|
||||
AND "minifigures"."fig_num" IS NOT DISTINCT FROM "missing_join"."set_num"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE fig_num IS NOT DISTINCT FROM :fig_num
|
||||
WHERE "minifigures"."fig_num" IS NOT DISTINCT FROM :fig_num
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
minifigures.fig_num
|
||||
"minifigures"."fig_num"
|
||||
{% endblock %}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends 'minifigure/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE fig_num IS NOT DISTINCT FROM :fig_num
|
||||
AND u_id IS NOT DISTINCT FROM :u_id
|
||||
AND set_num IS NOT DISTINCT FROM :set_num
|
||||
WHERE "minifigures"."fig_num" IS NOT DISTINCT FROM :fig_num
|
||||
AND "minifigures"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
AND "minifigures"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
{% endblock %}
|
||||
|
@ -1,2 +1,2 @@
|
||||
DELETE FROM missing
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
DELETE FROM "missing"
|
||||
WHERE "missing"."u_id" IS NOT DISTINCT FROM :u_id
|
@ -1,4 +1,4 @@
|
||||
DELETE FROM missing
|
||||
WHERE set_num IS NOT DISTINCT FROM :set_num
|
||||
AND id IS NOT DISTINCT FROM :id
|
||||
AND u_id IS NOT DISTINCT FROM :u_id
|
||||
DELETE FROM "missing"
|
||||
WHERE "missing"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
AND "missing"."id" IS NOT DISTINCT FROM :id
|
||||
AND "missing"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
|
@ -1,12 +1,12 @@
|
||||
INSERT INTO missing (
|
||||
set_num,
|
||||
id,
|
||||
part_num,
|
||||
part_img_url_id,
|
||||
color_id,
|
||||
quantity,
|
||||
element_id,
|
||||
u_id
|
||||
INSERT INTO "missing" (
|
||||
"set_num",
|
||||
"id",
|
||||
"part_num",
|
||||
"part_img_url_id",
|
||||
"color_id",
|
||||
"quantity",
|
||||
"element_id",
|
||||
"u_id"
|
||||
)
|
||||
VALUES(
|
||||
:set_num,
|
||||
|
@ -1,5 +1,5 @@
|
||||
UPDATE missing
|
||||
SET quantity = :quantity
|
||||
WHERE set_num IS NOT DISTINCT FROM :set_num
|
||||
AND id IS NOT DISTINCT FROM :id
|
||||
AND u_id IS NOT DISTINCT FROM :u_id
|
||||
UPDATE "missing"
|
||||
SET "quantity" = :quantity
|
||||
WHERE "missing"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
AND "missing"."id" IS NOT DISTINCT FROM :id
|
||||
AND "missing"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
|
@ -1,32 +1,32 @@
|
||||
SELECT
|
||||
inventory.set_num,
|
||||
inventory.id,
|
||||
inventory.part_num,
|
||||
inventory.name,
|
||||
inventory.part_img_url,
|
||||
inventory.part_img_url_id,
|
||||
inventory.color_id,
|
||||
inventory.color_name,
|
||||
inventory.quantity,
|
||||
inventory.is_spare,
|
||||
inventory.element_id,
|
||||
inventory.u_id,
|
||||
"inventory"."set_num",
|
||||
"inventory"."id",
|
||||
"inventory"."part_num",
|
||||
"inventory"."name",
|
||||
"inventory"."part_img_url",
|
||||
"inventory"."part_img_url_id",
|
||||
"inventory"."color_id",
|
||||
"inventory"."color_name",
|
||||
"inventory"."quantity",
|
||||
"inventory"."is_spare",
|
||||
"inventory"."element_id",
|
||||
"inventory"."u_id",
|
||||
{% block total_missing %}
|
||||
NULL AS total_missing, -- dummy for order: total_missing
|
||||
NULL AS "total_missing", -- dummy for order: total_missing
|
||||
{% endblock %}
|
||||
{% block total_quantity %}
|
||||
NULL AS total_quantity, -- dummy for order: total_quantity
|
||||
NULL AS "total_quantity", -- dummy for order: total_quantity
|
||||
{% endblock %}
|
||||
{% block total_spare %}
|
||||
NULL AS total_spare, -- dummy for order: total_spare
|
||||
NULL AS "total_spare", -- dummy for order: total_spare
|
||||
{% endblock %}
|
||||
{% block total_sets %}
|
||||
NULL AS total_sets, -- dummy for order: total_sets
|
||||
NULL AS "total_sets", -- dummy for order: total_sets
|
||||
{% endblock %}
|
||||
{% block total_minifigures %}
|
||||
NULL AS total_minifigures -- dummy for order: total_minifigures
|
||||
NULL AS "total_minifigures" -- dummy for order: total_minifigures
|
||||
{% endblock %}
|
||||
FROM inventory
|
||||
FROM "inventory"
|
||||
|
||||
{% block join %}{% endblock %}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
DELETE FROM inventory
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
DELETE FROM "inventory"
|
||||
WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id
|
@ -1,16 +1,16 @@
|
||||
INSERT INTO inventory (
|
||||
set_num,
|
||||
id,
|
||||
part_num,
|
||||
name,
|
||||
part_img_url,
|
||||
part_img_url_id,
|
||||
color_id,
|
||||
color_name,
|
||||
quantity,
|
||||
is_spare,
|
||||
element_id,
|
||||
u_id
|
||||
"set_num",
|
||||
"id",
|
||||
"part_num",
|
||||
"name",
|
||||
"part_img_url",
|
||||
"part_img_url_id",
|
||||
"color_id",
|
||||
"color_name",
|
||||
"quantity",
|
||||
"is_spare",
|
||||
"element_id",
|
||||
"u_id"
|
||||
) VALUES (
|
||||
:set_num,
|
||||
:id,
|
||||
|
@ -1,43 +1,43 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_quantity %}
|
||||
SUM(inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_quantity,
|
||||
SUM("inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_quantity",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_sets %}
|
||||
COUNT(DISTINCT sets.u_id) AS total_sets,
|
||||
COUNT(DISTINCT "sets"."u_id") AS "total_sets",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_minifigures %}
|
||||
SUM(IFNULL(minifigures.quantity, 0)) AS total_minifigures
|
||||
SUM(IFNULL("minifigures"."quantity", 0)) AS "total_minifigures"
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON inventory.set_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND inventory.id IS NOT DISTINCT FROM missing.id
|
||||
AND inventory.part_num IS NOT DISTINCT FROM missing.part_num
|
||||
AND inventory.color_id IS NOT DISTINCT FROM missing.color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM missing.element_id
|
||||
AND inventory.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id"
|
||||
AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num"
|
||||
AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id"
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
|
||||
LEFT JOIN minifigures
|
||||
ON inventory.set_num IS NOT DISTINCT FROM minifigures.fig_num
|
||||
AND inventory.u_id IS NOT DISTINCT FROM minifigures.u_id
|
||||
LEFT JOIN "minifigures"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id"
|
||||
|
||||
LEFT JOIN sets
|
||||
ON inventory.u_id IS NOT DISTINCT FROM sets.u_id
|
||||
ON "inventory"."u_id" IS NOT DISTINCT FROM "sets"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
inventory.part_num,
|
||||
inventory.name,
|
||||
inventory.color_id,
|
||||
inventory.is_spare,
|
||||
inventory.element_id
|
||||
"inventory"."part_num",
|
||||
"inventory"."name",
|
||||
"inventory"."color_id",
|
||||
"inventory"."is_spare",
|
||||
"inventory"."element_id"
|
||||
{% endblock %}
|
||||
|
@ -2,27 +2,27 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON missing.set_num IS NOT DISTINCT FROM inventory.set_num
|
||||
AND missing.id IS NOT DISTINCT FROM inventory.id
|
||||
AND missing.part_num IS NOT DISTINCT FROM inventory.part_num
|
||||
AND missing.color_id IS NOT DISTINCT FROM inventory.color_id
|
||||
AND missing.element_id IS NOT DISTINCT FROM inventory.element_id
|
||||
LEFT JOIN "missing"
|
||||
ON "missing"."set_num" IS NOT DISTINCT FROM "inventory"."set_num"
|
||||
AND "missing"."id" IS NOT DISTINCT FROM "inventory"."id"
|
||||
AND "missing"."part_num" IS NOT DISTINCT FROM "inventory"."part_num"
|
||||
AND "missing"."color_id" IS NOT DISTINCT FROM "inventory"."color_id"
|
||||
AND "missing"."element_id" IS NOT DISTINCT FROM "inventory"."element_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE inventory.set_num IS NOT DISTINCT FROM :set_num
|
||||
WHERE "inventory"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
inventory.part_num,
|
||||
inventory.name,
|
||||
inventory.color_id,
|
||||
inventory.is_spare,
|
||||
inventory.element_id
|
||||
"inventory"."part_num",
|
||||
"inventory"."name",
|
||||
"inventory"."color_id",
|
||||
"inventory"."is_spare",
|
||||
"inventory"."element_id"
|
||||
{% endblock %}
|
||||
|
@ -2,20 +2,20 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
IFNULL(missing.quantity, 0) AS total_missing,
|
||||
IFNULL("missing"."quantity", 0) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON inventory.set_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND inventory.id IS NOT DISTINCT FROM missing.id
|
||||
AND inventory.part_num IS NOT DISTINCT FROM missing.part_num
|
||||
AND inventory.color_id IS NOT DISTINCT FROM missing.color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM missing.element_id
|
||||
AND inventory.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id"
|
||||
AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num"
|
||||
AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id"
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE inventory.u_id IS NOT DISTINCT FROM :u_id
|
||||
AND inventory.set_num IS NOT DISTINCT FROM :set_num
|
||||
WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
AND "inventory"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
{% endblock %}
|
||||
|
@ -1,36 +1,36 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_sets %}
|
||||
COUNT(inventory.u_id) - COUNT(minifigures.u_id) AS total_sets,
|
||||
COUNT("inventory"."u_id") - COUNT("minifigures"."u_id") AS "total_sets",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_minifigures %}
|
||||
SUM(IFNULL(minifigures.quantity, 0)) AS total_minifigures
|
||||
SUM(IFNULL("minifigures"."quantity", 0)) AS "total_minifigures"
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
INNER JOIN missing
|
||||
ON missing.set_num IS NOT DISTINCT FROM inventory.set_num
|
||||
AND missing.id IS NOT DISTINCT FROM inventory.id
|
||||
AND missing.part_num IS NOT DISTINCT FROM inventory.part_num
|
||||
AND missing.color_id IS NOT DISTINCT FROM inventory.color_id
|
||||
AND missing.element_id IS NOT DISTINCT FROM inventory.element_id
|
||||
AND missing.u_id IS NOT DISTINCT FROM inventory.u_id
|
||||
INNER JOIN "missing"
|
||||
ON "missing"."set_num" IS NOT DISTINCT FROM "inventory"."set_num"
|
||||
AND "missing"."id" IS NOT DISTINCT FROM "inventory"."id"
|
||||
AND "missing"."part_num" IS NOT DISTINCT FROM "inventory"."part_num"
|
||||
AND "missing"."color_id" IS NOT DISTINCT FROM "inventory"."color_id"
|
||||
AND "missing"."element_id" IS NOT DISTINCT FROM "inventory"."element_id"
|
||||
AND "missing"."u_id" IS NOT DISTINCT FROM "inventory"."u_id"
|
||||
|
||||
LEFT JOIN minifigures
|
||||
ON missing.set_num IS NOT DISTINCT FROM minifigures.fig_num
|
||||
AND missing.u_id IS NOT DISTINCT FROM minifigures.u_id
|
||||
LEFT JOIN "minifigures"
|
||||
ON "missing"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num"
|
||||
AND "missing"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
inventory.part_num,
|
||||
inventory.name,
|
||||
inventory.color_id,
|
||||
inventory.is_spare,
|
||||
inventory.element_id
|
||||
"inventory"."part_num",
|
||||
"inventory"."name",
|
||||
"inventory"."color_id",
|
||||
"inventory"."is_spare",
|
||||
"inventory"."element_id"
|
||||
{% endblock %}
|
||||
|
@ -1,40 +1,40 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block total_missing %}
|
||||
SUM(IFNULL(missing.quantity, 0)) AS total_missing,
|
||||
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_quantity %}
|
||||
SUM((NOT inventory.is_spare) * inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_quantity,
|
||||
SUM((NOT "inventory"."is_spare") * "inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_quantity",
|
||||
{% endblock %}
|
||||
|
||||
{% block total_spare %}
|
||||
SUM(inventory.is_spare * inventory.quantity * IFNULL(minifigures.quantity, 1)) AS total_spare,
|
||||
SUM("inventory"."is_spare" * "inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_spare",
|
||||
{% endblock %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON inventory.set_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND inventory.id IS NOT DISTINCT FROM missing.id
|
||||
AND inventory.part_num IS NOT DISTINCT FROM missing.part_num
|
||||
AND inventory.color_id IS NOT DISTINCT FROM missing.color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM missing.element_id
|
||||
AND inventory.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id"
|
||||
AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num"
|
||||
AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id"
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
|
||||
LEFT JOIN minifigures
|
||||
ON inventory.set_num IS NOT DISTINCT FROM minifigures.fig_num
|
||||
AND inventory.u_id IS NOT DISTINCT FROM minifigures.u_id
|
||||
LEFT JOIN "minifigures"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE inventory.part_num IS NOT DISTINCT FROM :part_num
|
||||
AND inventory.color_id IS NOT DISTINCT FROM :color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM :element_id
|
||||
WHERE "inventory"."part_num" IS NOT DISTINCT FROM :part_num
|
||||
AND "inventory"."color_id" IS NOT DISTINCT FROM :color_id
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
inventory.part_num,
|
||||
inventory.color_id,
|
||||
inventory.element_id
|
||||
"inventory"."part_num",
|
||||
"inventory"."color_id",
|
||||
"inventory"."element_id"
|
||||
{% endblock %}
|
||||
|
@ -1,24 +1,24 @@
|
||||
{% extends 'part/base/select.sql' %}
|
||||
|
||||
{% block join %}
|
||||
LEFT JOIN missing
|
||||
ON inventory.set_num IS NOT DISTINCT FROM missing.set_num
|
||||
AND inventory.id IS NOT DISTINCT FROM missing.id
|
||||
AND inventory.u_id IS NOT DISTINCT FROM missing.u_id
|
||||
LEFT JOIN "missing"
|
||||
ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num"
|
||||
AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id"
|
||||
AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE inventory.u_id IS NOT DISTINCT FROM :u_id
|
||||
AND inventory.set_num IS NOT DISTINCT FROM :set_num
|
||||
AND inventory.id IS NOT DISTINCT FROM :id
|
||||
WHERE "inventory"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
AND "inventory"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
AND "inventory"."id" IS NOT DISTINCT FROM :id
|
||||
{% endblock %}
|
||||
|
||||
{% block group %}
|
||||
GROUP BY
|
||||
inventory.set_num,
|
||||
inventory.id,
|
||||
inventory.part_num,
|
||||
inventory.color_id,
|
||||
inventory.element_id,
|
||||
inventory.u_id
|
||||
"inventory"."set_num",
|
||||
"inventory"."id",
|
||||
"inventory"."part_num",
|
||||
"inventory"."color_id",
|
||||
"inventory"."element_id",
|
||||
"inventory"."u_id"
|
||||
{% endblock %}
|
||||
|
@ -1,2 +1,2 @@
|
||||
SELECT COUNT(*) AS count
|
||||
FROM {{ table }}
|
||||
SELECT COUNT(*) AS "count"
|
||||
FROM "{{ table }}"
|
@ -1,9 +1,9 @@
|
||||
BEGIN transaction;
|
||||
|
||||
DROP TABLE IF EXISTS wishlist;
|
||||
DROP TABLE IF EXISTS sets;
|
||||
DROP TABLE IF EXISTS inventory;
|
||||
DROP TABLE IF EXISTS minifigures;
|
||||
DROP TABLE IF EXISTS missing;
|
||||
DROP TABLE IF EXISTS "wishlist";
|
||||
DROP TABLE IF EXISTS "sets";
|
||||
DROP TABLE IF EXISTS "inventory";
|
||||
DROP TABLE IF EXISTS "minifigures";
|
||||
DROP TABLE IF EXISTS "missing";
|
||||
|
||||
COMMIT;
|
@ -1,45 +1,45 @@
|
||||
SELECT
|
||||
sets.set_num,
|
||||
sets.name,
|
||||
sets.year,
|
||||
sets.theme_id,
|
||||
sets.num_parts,
|
||||
sets.set_img_url,
|
||||
sets.set_url,
|
||||
sets.last_modified_dt,
|
||||
sets.mini_col,
|
||||
sets.set_check,
|
||||
sets.set_col,
|
||||
sets.u_id,
|
||||
"sets"."set_num",
|
||||
"sets"."name",
|
||||
"sets"."year",
|
||||
"sets"."theme_id",
|
||||
"sets"."num_parts",
|
||||
"sets"."set_img_url",
|
||||
"sets"."set_url",
|
||||
"sets"."last_modified_dt",
|
||||
"sets"."mini_col",
|
||||
"sets"."set_check",
|
||||
"sets"."set_col",
|
||||
"sets"."u_id",
|
||||
{% block number %}
|
||||
CAST(SUBSTR(sets.set_num, 1, INSTR(sets.set_num, '-') - 1) AS INTEGER) AS set_number,
|
||||
CAST(SUBSTR(sets.set_num, 1, INSTR(sets.set_num, '-') + 1) AS INTEGER) AS set_version,
|
||||
CAST(SUBSTR("sets"."set_num", 1, INSTR("sets"."set_num", '-') - 1) AS INTEGER) AS "set_number",
|
||||
CAST(SUBSTR("sets"."set_num", 1, INSTR("sets"."set_num", '-') + 1) AS INTEGER) AS "set_version",
|
||||
{% endblock %}
|
||||
IFNULL(missing_join.total, 0) AS total_missing,
|
||||
IFNULL(minifigures_join.total, 0) AS total_minifigures
|
||||
IFNULL("missing_join"."total", 0) AS "total_missing",
|
||||
IFNULL("minifigures_join"."total", 0) AS "total_minifigures"
|
||||
FROM sets
|
||||
|
||||
-- LEFT JOIN + SELECT to avoid messing the total
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
u_id,
|
||||
SUM(quantity) AS total
|
||||
FROM missing
|
||||
"missing"."u_id",
|
||||
SUM("missing"."quantity") AS "total"
|
||||
FROM "missing"
|
||||
{% block where_missing %}{% endblock %}
|
||||
GROUP BY u_id
|
||||
) missing_join
|
||||
ON sets.u_id IS NOT DISTINCT FROM missing_join.u_id
|
||||
GROUP BY "u_id"
|
||||
) "missing_join"
|
||||
ON "sets"."u_id" IS NOT DISTINCT FROM "missing_join"."u_id"
|
||||
|
||||
-- LEFT JOIN + SELECT to avoid messing the total
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
u_id,
|
||||
SUM(quantity) AS total
|
||||
FROM minifigures
|
||||
"minifigures"."u_id",
|
||||
SUM("minifigures"."quantity") AS "total"
|
||||
FROM "minifigures"
|
||||
{% block where_minifigures %}{% endblock %}
|
||||
GROUP BY u_id
|
||||
) minifigures_join
|
||||
ON sets.u_id IS NOT DISTINCT FROM minifigures_join.u_id
|
||||
GROUP BY "u_id"
|
||||
) "minifigures_join"
|
||||
ON "sets"."u_id" IS NOT DISTINCT FROM "minifigures_join"."u_id"
|
||||
|
||||
{% block where %}{% endblock %}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
DELETE FROM sets
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
DELETE FROM "sets"
|
||||
WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id
|
@ -1,16 +1,16 @@
|
||||
INSERT INTO sets (
|
||||
set_num,
|
||||
name,
|
||||
year,
|
||||
theme_id,
|
||||
num_parts,
|
||||
set_img_url,
|
||||
set_url,
|
||||
last_modified_dt,
|
||||
mini_col,
|
||||
set_check,
|
||||
set_col,
|
||||
u_id
|
||||
"set_num",
|
||||
"name",
|
||||
"year",
|
||||
"theme_id",
|
||||
"num_parts",
|
||||
"set_img_url",
|
||||
"set_url",
|
||||
"last_modified_dt",
|
||||
"mini_col",
|
||||
"set_check",
|
||||
"set_col",
|
||||
"u_id"
|
||||
) VALUES (
|
||||
:set_num,
|
||||
:name,
|
||||
|
@ -1,12 +1,12 @@
|
||||
SELECT
|
||||
sets.set_num,
|
||||
sets.name,
|
||||
sets.year,
|
||||
sets.theme_id,
|
||||
sets.num_parts,
|
||||
sets.set_img_url,
|
||||
sets.set_url
|
||||
FROM sets
|
||||
"sets"."set_num",
|
||||
"sets"."name",
|
||||
"sets"."year",
|
||||
"sets"."theme_id",
|
||||
"sets"."num_parts",
|
||||
"sets"."set_img_url",
|
||||
"sets"."set_url"
|
||||
FROM "sets"
|
||||
|
||||
GROUP BY
|
||||
sets.set_num
|
||||
"sets"."set_num"
|
||||
|
@ -1,13 +1,13 @@
|
||||
{% extends 'set/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE sets.u_id IN (
|
||||
WHERE "sets"."u_id" IN (
|
||||
SELECT
|
||||
missing.u_id
|
||||
FROM missing
|
||||
"missing"."u_id"
|
||||
FROM "missing"
|
||||
|
||||
WHERE missing.set_num IS NOT DISTINCT FROM :fig_num
|
||||
WHERE "missing"."set_num" IS NOT DISTINCT FROM :fig_num
|
||||
|
||||
GROUP BY missing.u_id
|
||||
GROUP BY "missing"."u_id"
|
||||
)
|
||||
{% endblock %}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{% extends 'set/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE sets.u_id IN (
|
||||
WHERE "sets"."u_id" IN (
|
||||
SELECT
|
||||
missing.u_id
|
||||
FROM missing
|
||||
"missing"."u_id"
|
||||
FROM "missing"
|
||||
|
||||
WHERE missing.color_id IS NOT DISTINCT FROM :color_id
|
||||
AND missing.element_id IS NOT DISTINCT FROM :element_id
|
||||
AND missing.part_num IS NOT DISTINCT FROM :part_num
|
||||
WHERE "missing"."color_id" IS NOT DISTINCT FROM :color_id
|
||||
AND "missing"."element_id" IS NOT DISTINCT FROM :element_id
|
||||
AND "missing"."part_num" IS NOT DISTINCT FROM :part_num
|
||||
|
||||
GROUP BY missing.u_id
|
||||
GROUP BY "missing"."u_id"
|
||||
)
|
||||
{% endblock %}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{% extends 'set/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE sets.u_id IN (
|
||||
WHERE "sets"."u_id" IN (
|
||||
SELECT
|
||||
inventory.u_id
|
||||
FROM inventory
|
||||
"inventory"."u_id"
|
||||
FROM "inventory"
|
||||
|
||||
WHERE inventory.set_num IS NOT DISTINCT FROM :fig_num
|
||||
WHERE "inventory"."set_num" IS NOT DISTINCT FROM :fig_num
|
||||
|
||||
GROUP BY inventory.u_id
|
||||
GROUP BY "inventory"."u_id"
|
||||
)
|
||||
{% endblock %}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{% extends 'set/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE sets.u_id IN (
|
||||
WHERE "sets"."u_id" IN (
|
||||
SELECT
|
||||
inventory.u_id
|
||||
FROM inventory
|
||||
"inventory"."u_id"
|
||||
FROM "inventory"
|
||||
|
||||
WHERE inventory.color_id IS NOT DISTINCT FROM :color_id
|
||||
AND inventory.element_id IS NOT DISTINCT FROM :element_id
|
||||
AND inventory.part_num IS NOT DISTINCT FROM :part_num
|
||||
WHERE "inventory"."color_id" IS NOT DISTINCT FROM :color_id
|
||||
AND "inventory"."element_id" IS NOT DISTINCT FROM :element_id
|
||||
AND "inventory"."part_num" IS NOT DISTINCT FROM :part_num
|
||||
|
||||
GROUP BY inventory.u_id
|
||||
GROUP BY "inventory"."u_id"
|
||||
)
|
||||
{% endblock %}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{% extends 'set/base/select.sql' %}
|
||||
|
||||
{% block where_missing %}
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
WHERE "missing"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
{% endblock %}
|
||||
|
||||
{% block where_minifigures %}
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
WHERE "minifigures"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
{% endblock %}
|
||||
|
||||
{% block where %}
|
||||
WHERE sets.u_id IS NOT DISTINCT FROM :u_id
|
||||
WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
{% endblock %}
|
||||
|
@ -1,3 +1,3 @@
|
||||
UPDATE sets
|
||||
SET {{name}} = :status
|
||||
WHERE u_id IS NOT DISTINCT FROM :u_id
|
||||
UPDATE "sets"
|
||||
SET "{{name}}" = :status
|
||||
WHERE "sets"."u_id" IS NOT DISTINCT FROM :u_id
|
||||
|
@ -1,13 +1,13 @@
|
||||
SELECT
|
||||
wishlist.set_num,
|
||||
wishlist.name,
|
||||
wishlist.year,
|
||||
wishlist.theme_id,
|
||||
wishlist.num_parts,
|
||||
wishlist.set_img_url,
|
||||
wishlist.set_url,
|
||||
wishlist.last_modified_dt
|
||||
FROM wishlist
|
||||
"wishlist"."set_num",
|
||||
"wishlist"."name",
|
||||
"wishlist"."year",
|
||||
"wishlist"."theme_id",
|
||||
"wishlist"."num_parts",
|
||||
"wishlist"."set_img_url",
|
||||
"wishlist"."set_url",
|
||||
"wishlist"."last_modified_dt"
|
||||
FROM "wishlist"
|
||||
|
||||
{% block where %}{% endblock %}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
DELETE FROM wishlist
|
||||
WHERE set_num IS NOT DISTINCT FROM :set_num
|
||||
DELETE FROM "wishlist"
|
||||
WHERE "wishlist"."set_num" IS NOT DISTINCT FROM :set_num
|
@ -1,12 +1,12 @@
|
||||
INSERT INTO wishlist (
|
||||
set_num,
|
||||
name,
|
||||
year,
|
||||
theme_id,
|
||||
num_parts,
|
||||
set_img_url,
|
||||
set_url,
|
||||
last_modified_dt
|
||||
INSERT INTO "wishlist" (
|
||||
"set_num",
|
||||
"name",
|
||||
"year",
|
||||
"theme_id",
|
||||
"num_parts",
|
||||
"set_img_url",
|
||||
"set_url",
|
||||
"last_modified_dt"
|
||||
) VALUES (
|
||||
:set_num,
|
||||
:name,
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends 'wish/base/select.sql' %}
|
||||
|
||||
{% block where %}
|
||||
WHERE wishlist.set_num IS NOT DISTINCT FROM :set_num
|
||||
WHERE "wishlist"."set_num" IS NOT DISTINCT FROM :set_num
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user