1 CREATE TABLE `categories` (
2 `category_id` INTEGER PRIMARY KEY,
3 `category` varchar(255) UNIQUE NOT NULL,
4 `order_id` int(10) NOT NULL,
5 PRIMARY KEY (`category_id`)
8 CREATE TABLE IF NOT EXISTS `tags` (
9 `id` INTEGER PRIMARY KEY,
10 `tag` varchar(64) NOT NULL,
11 `category_id` INTEGER NOT NULL,
12 FOREIGN KEY (`category_id`) REFERENCES `categories` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
15 CREATE TABLE IF NOT EXISTS `projects` (
16 `id` INTEGER PRIMARY KEY,
17 `name` varchar(32) UNIQUE NOT NULL
21 CREATE TABLE IF NOT EXISTS `asset_inventory` (
22 `id` INTEGER PRIMARY KEY,
23 `project_id` INTEGER NOT NULL,
24 `relpath` varchar(255) NOT NULL,
25 `description` varchar(255),
26 FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
29 CREATE TABLE IF NOT EXISTS `asset_tags` (
30 `asset_id` INTEGER NOT NULL,
31 `tag_id` INTEGER NOT NULL,
32 PRIMARY KEY (`asset_id`,`tag_id`),
33 FOREIGN KEY (`asset_id`) REFERENCES `asset_inventory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
34 FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE