2025-01-17 11:03:00 +01:00
|
|
|
-- FROM sqlite3 app.db .schema > init.sql with extra IF NOT EXISTS and transaction
|
|
|
|
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 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 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
|
|
|
|
);
|
|
|
|
|
2025-01-17 17:19:31 +01:00
|
|
|
-- Fix a bug where 'None' was inserted in missing instead of NULL
|
|
|
|
UPDATE missing
|
|
|
|
SET element_id = NULL
|
|
|
|
WHERE element_id = 'None';
|
|
|
|
|
2025-01-17 11:03:00 +01:00
|
|
|
COMMIT;
|