-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcreate_table.sql
More file actions
65 lines (53 loc) · 1.5 KB
/
create_table.sql
File metadata and controls
65 lines (53 loc) · 1.5 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--
--`components`
--
CREATE TABLE IF NOT EXISTS `component` (
`id` int(10) unsigned NOT NULL,
`component` varchar(255) NOT NULL,
`url` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`settings` text NOT NULL,
`ordering` int NOT NULL
) AUTO_INCREMENT=1;
ALTER TABLE `component`
ADD PRIMARY KEY (`id`), ADD KEY `url` (`url`);
ALTER TABLE `component`
MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
--`sections`
--
CREATE TABLE `sections` (
`id` int(10) UNSIGNED NOT NULL,
`catalog_id` int(10) UNSIGNED NOT NULL,
`parent_id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL,
`image` varchar(50) NOT NULL,
`text` longtext NOT NULL,
`data` text NOT NULL,
`date` datetime NOT NULL,
`status` int(3) NOT NULL,
`ordering` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `sections`
ADD PRIMARY KEY (`id`),
ADD KEY `catalog_id` (`catalog_id`);
ALTER TABLE `sections`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;
CREATE TABLE `items` (
`id` int(10) UNSIGNED NOT NULL,
`section_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`text` longtext NOT NULL,
`data` longtext NOT NULL,
`date` datetime NOT NULL,
`status` int(11) NOT NULL,
`ordering` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `items`
ADD PRIMARY KEY (`id`),
ADD KEY `section_id` (`section_id`);
ALTER TABLE `items`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;