5 CREATE TABLE CssStyleSheet (
6 `id` INTEGER PRIMARY KEY NOT NULL
10 `id` INTEGER PRIMARY KEY NOT NULL,
11 `style_sheet_id` INTEGER NOT NULL,
12 UNIQUE (`style_sheet_id`),
13 FOREIGN KEY (`style_sheet_id`) REFERENCES CssStyleSheet (`id`)
14 ON UPDATE CASCADE ON DELETE RESTRICT
17 CREATE TABLE CssRuleCriteriaScope (
18 `rule_id` INTEGER NOT NULL,
19 `order` INTEGER NOT NULL,
20 `type` VARCHAR(32) NULL,
21 `name` VARCHAR(32) NULL,
22 PRIMARY KEY (`rule_id`, `order`),
23 FOREIGN KEY (`rule_id`) REFERENCES CssRule (`id`)
24 ON UPDATE CASCADE ON DELETE RESTRICT
27 CREATE TABLE CssRuleCriteriaClass (
28 `rule_id` INTEGER NOT NULL,
29 `class` VARCHAR(64) NOT NULL,
30 PRIMARY KEY (`rule_id`, `class`),
31 FOREIGN KEY (`rule_id`) REFERENCES CssRule (`id`)
32 ON UPDATE CASCADE ON DELETE RESTRICT
35 CREATE TABLE CssRuleUsedClass (
36 `rule_id` INTEGER NOT NULL,
37 `class` VARCHAR(64) NOT NULL,
38 PRIMARY KEY (`rule_id`, `class`),
39 FOREIGN KEY (`rule_id`) REFERENCES CssRule (`id`)
40 ON UPDATE CASCADE ON DELETE RESTRICT
43 CREATE TABLE CssRuleStyle (
44 `rule_id` INTEGER NOT NULL,
45 `style` VARCHAR(64) NOT NULL,
46 `value` VARCHAR(256) NOT NULL,
47 PRIMARY KEY (`rule_id`, `style`),
48 FOREIGN KEY (`rule_id`) REFERENCES CssRule (`id`)
49 ON UPDATE CASCADE ON DELETE RESTRICT
55 `id` INTEGER PRIMARY KEY NOT NULL,
56 `name` VARCHAR(128) NOT NULL,
57 `alternate_name` VARCHAR(128) NOT NULL DEFAULT "",
58 `css_style_sheet_id` INTEGER NULL,
60 UNIQUE (`css_style_sheet_id`),
61 FOREIGN KEY (`css_style_sheet_id`) REFERENCES CssStyleSheet (`id`)
62 ON UPDATE CASCADE ON DELETE CASCADE
65 CREATE TABLE SongBook (
66 `id` INTEGER PRIMARY KEY NOT NULL,
67 `abreviation` VARCHAR(8) NOT NULL,
68 `name` VARCHAR(128) NOT NULL,
69 `description` MEDIUMTEXT NULL,
70 UNIQUE (`abreviation`)
73 CREATE TABLE SongVersion (
74 `id` INTEGER PRIMARY KEY NOT NULL,
75 `song_id` INTEGER NOT NULL,
76 `name` VARCHAR(128) NULL,
77 `css_style_sheet_id` INTEGER NULL,
78 `writer` VARCHAR(128) NULL,
79 `copyright` VARCHAR(128) NULL,
80 `lyrics` TEXT NOT NULL,
81 UNIQUE (`song_id`, `name`),
82 FOREIGN KEY (`song_id`) REFERENCES Song (`id`)
83 ON UPDATE CASCADE ON DELETE RESTRICT,
84 FOREIGN KEY (`css_style_sheet_id`) REFERENCES CssStyleSheet (`id`)
85 ON UPDATE CASCADE ON DELETE CASCADE
88 CREATE TABLE SongBookSong (
89 `book_id` INTEGER NOT NULL,
90 `book_number` INTEGER NOT NULL,
91 `version_id` INTEGER NOT NULL,
92 PRIMARY KEY (`book_id`, `book_number`),
93 FOREIGN KEY (`book_id`) REFERENCES SongBook (`id`)
94 ON UPDATE CASCADE ON DELETE RESTRICT,
95 FOREIGN KEY (`version_id`) REFERENCES SongVersion (`id`)
96 ON UPDATE CASCADE ON DELETE RESTRICT
99 CREATE TABLE SongMedia (
100 `id` INTEGER PRIMARY KEY NOT NULL,
101 `version_id` INTEGER NOT NULL,
102 `url` VARCHAR(128) NOT NULL,
103 `audio_use` BOOLEAN NOT NULL DEFAULT FALSE,
104 `audio_volume` FLOAT NOT NULL DEFAULT 1.0,
105 `video_use` BOOLEAN NOT NULL DEFAULT FALSE,
106 FOREIGN KEY (`version_id`) REFERENCES SongVersion (`id`)
107 ON UPDATE CASCADE ON DELETE RESTRICT
111 /* Populate the database with some data */