This repository has been archived by the owner on Jan 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
/
312-app-device-types.sql
45 lines (37 loc) · 1.65 KB
/
312-app-device-types.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
CREATE TABLE `devicetypes` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`name` int(11) UNSIGNED DEFAULT NULL,
`class_name` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;
CREATE TABLE `addons_devicetypes` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`addon_id` int(11) UNSIGNED NOT NULL,
`device_type_id` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY `device_type_id_refs_id_4d64c634` (`device_type_id`),
CONSTRAINT `device_type_id_refs_id_4d64c634`
FOREIGN KEY (`device_type_id`) REFERENCES `devicetypes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
COLLATE utf8_general_ci;
UPDATE translations_seq SET id = LAST_INSERT_ID(id + 1);
SELECT LAST_INSERT_ID() FROM translations_seq INTO @desktop;
INSERT INTO translations (id, locale, localized_string)
VALUES ((SELECT @desktop), 'en-US', 'Desktop');
UPDATE translations_seq SET id = LAST_INSERT_ID(id + 1);
SELECT LAST_INSERT_ID() FROM translations_seq INTO @mobile;
INSERT INTO translations (id, locale, localized_string)
VALUES ((SELECT @mobile), 'en-US', 'Mobile');
UPDATE translations_seq SET id = LAST_INSERT_ID(id + 1);
SELECT LAST_INSERT_ID() FROM translations_seq INTO @tablet;
INSERT INTO translations (id, locale, localized_string)
VALUES ((SELECT @tablet), 'en-US', 'Tablet');
INSERT INTO `devicetypes` (id, name, class_name)
VALUES (1, @desktop, 'desktop'),
(2, @mobile, 'mobile'),
(3, @tablet, 'tablet');