-
Notifications
You must be signed in to change notification settings - Fork 1
/
breadbuilder.sql
47 lines (42 loc) · 2.08 KB
/
breadbuilder.sql
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
DROP TABLE IF EXISTS `data_rows`;
CREATE TABLE IF NOT EXISTS `data_rows` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`data_type_id` int(10) UNSIGNED NOT NULL,
`field` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`required` tinyint(1) NOT NULL DEFAULT '0',
`browse` tinyint(1) NOT NULL DEFAULT '0',
`read` tinyint(1) NOT NULL DEFAULT '0',
`edit` tinyint(1) NOT NULL DEFAULT '0',
`add` tinyint(1) NOT NULL DEFAULT '0',
`delete` tinyint(1) NOT NULL DEFAULT '0',
`details` text COLLATE utf8_unicode_ci,
`order` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `data_rows_data_type_id_foreign` (`data_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `data_types`;
CREATE TABLE IF NOT EXISTS `data_types` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`display_name_singular` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`display_name_plural` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`icon` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`model_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`policy_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`controller` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`generate_permissions` tinyint(1) NOT NULL DEFAULT '0',
`server_side` tinyint(4) NOT NULL DEFAULT '0',
`details` text COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `data_types_name_unique` (`name`),
UNIQUE KEY `data_types_slug_unique` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `data_rows`
ADD CONSTRAINT `data_rows_data_type_id_foreign` FOREIGN KEY (`data_type_id`) REFERENCES `data_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;