Bulks sourceEntry conversion
parent
4e295080d8
commit
a9d20d40dd
|
@ -6,17 +6,40 @@ PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
|
|||
-- on PER CONNECTION
|
||||
INSERT INTO bulks (
|
||||
bulk_id,
|
||||
sources_id,
|
||||
sources_pages,
|
||||
short_name,
|
||||
long_name,
|
||||
numerical)
|
||||
VALUES
|
||||
(1, 1, '271-72', '-', 'Negligible', 0.0),
|
||||
(2, 1, '271-72', 'L', 'Light', 0.1),
|
||||
(3, 1, '271-72', '1', 'One', 1.0),
|
||||
(4, 1, '271-72', '2', 'Two', 2.0),
|
||||
(5, 1, '271-72', '3', 'Three', 3.0),
|
||||
(6, 1, '271-72', '4', 'Four', 4.0),
|
||||
(7, 1, '271-72', '5', 'Five', 5.0);
|
||||
(1, 1, '-', 'Negligible', 0.0),
|
||||
(2, 1, 'L', 'Light', 0.1),
|
||||
(3, 1, '1', 'One', 1.0),
|
||||
(4, 1, '2', 'Two', 2.0),
|
||||
(5, 1, '3', 'Three', 3.0),
|
||||
(6, 1, '4', 'Four', 4.0),
|
||||
(7, 1, '5', 'Five', 5.0);
|
||||
|
||||
INSERT INTO sourceentries (
|
||||
sourceentry_id
|
||||
,sources_id
|
||||
,page_start
|
||||
,page_stop
|
||||
)
|
||||
VALUES
|
||||
-- 800 to 899 is reserved for bulks --
|
||||
(800, 1, 271, 272) -- '-', L, 1, 2, 3, 4, 5 --
|
||||
;
|
||||
|
||||
INSERT INTO bulks_sourceentries (
|
||||
id
|
||||
,bulk_id
|
||||
,sourceentry_id
|
||||
)
|
||||
VALUES
|
||||
(1, 1, 800) -- '-' --
|
||||
,(2, 2, 800) -- L --
|
||||
,(3, 3, 800) -- 1 --
|
||||
,(4, 4, 800) -- 2 --
|
||||
,(5, 5, 800) -- 3 --
|
||||
,(6, 6, 800) -- 4 --
|
||||
,(7, 7, 800) -- 5 --
|
||||
;
|
|
@ -1,10 +1,17 @@
|
|||
CREATE TABLE bulks (
|
||||
bulk_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
short_name TEXT NOT NULL,
|
||||
long_name TEXT NOT NULL,
|
||||
numerical FLOAT NOT NULL,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
-- Joining table --
|
||||
CREATE TABLE bulks_sourceentries (
|
||||
id INTEGER PRIMARY KEY
|
||||
,bulk_id INTEGER NOT NULL
|
||||
,sourceentry_id INTEGER NOT NULL
|
||||
,UNIQUE (id, bulk_id, soruceentry_id),
|
||||
,FOREIGN KEY (bulk_id) REFERENCES bulks(bulk_id)
|
||||
,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
|
||||
);
|
Loading…
Reference in New Issue