forked from yiiext/taggable-behavior
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
29 lines (26 loc) · 692 Bytes
/
Copy pathschema.sql
File metadata and controls
29 lines (26 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Tag table */
CREATE TABLE `Tag` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `Tag_name` (`name`)
);
/* Tag binding table */
CREATE TABLE `PostTag` (
`post_id` INT(10) UNSIGNED NOT NULL,
`tagId` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`post_id`,`tagId`)
);
/* Tag table */
CREATE TABLE `Color` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `Color_name` (`name`)
);
/* Tag binding table */
CREATE TABLE `PostColor` (
`post_id` INT(10) UNSIGNED NOT NULL,
`colorId` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`post_id`,`colorId`)
);