UNPKG

8.51 kBapplication/x-sqlView Raw
1DROP TABLE IF EXISTS `apps`;
2CREATE TABLE `apps` (
3 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
4 `name` varchar(50) NOT NULL DEFAULT '',
5 `uid` bigint(20) unsigned NOT NULL DEFAULT '0',
6 `os` tinyint(3) unsigned NOT NULL DEFAULT '0',
7 `platform` tinyint(3) unsigned NOT NULL DEFAULT '0',
8 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
9 `created_at` timestamp NULL DEFAULT NULL,
10 `deleted_at` timestamp NULL DEFAULT NULL,
11 PRIMARY KEY (`id`),
12 KEY `idx_name` (`name`(12))
13) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
14
15DROP TABLE IF EXISTS `collaborators`;
16CREATE TABLE `collaborators` (
17 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
18 `appid` int(10) unsigned NOT NULL DEFAULT '0',
19 `uid` bigint(20) unsigned NOT NULL DEFAULT '0',
20 `roles` varchar(20) NOT NULL DEFAULT '',
21 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
22 `created_at` timestamp NULL DEFAULT NULL,
23 `deleted_at` timestamp NULL DEFAULT NULL,
24 PRIMARY KEY (`id`),
25 KEY `idx_appid` (`appid`),
26 KEY `idx_uid` (`uid`)
27) ENGINE=InnoDB DEFAULT CHARSET=utf8;
28
29
30DROP TABLE IF EXISTS `deployments`;
31CREATE TABLE `deployments` (
32 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
33 `appid` int(10) unsigned NOT NULL DEFAULT '0',
34 `name` varchar(20) NOT NULL DEFAULT '',
35 `description` varchar(500) NOT NULL DEFAULT '',
36 `deployment_key` varchar(64) NOT NULL,
37 `last_deployment_version_id` int(10) unsigned NOT NULL DEFAULT '0',
38 `label_id` int(11) unsigned NOT NULL DEFAULT '0',
39 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
40 `created_at` timestamp NULL DEFAULT NULL,
41 `deleted_at` timestamp NULL DEFAULT NULL,
42 PRIMARY KEY (`id`),
43 KEY `idx_appid` (`appid`),
44 KEY `idx_deploymentkey` (`deployment_key`(40))
45) ENGINE=InnoDB DEFAULT CHARSET=utf8;
46
47DROP TABLE IF EXISTS `deployments_history`;
48CREATE TABLE `deployments_history` (
49 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
50 `deployment_id` int(11) unsigned NOT NULL DEFAULT '0',
51 `package_id` int(10) unsigned NOT NULL DEFAULT '0',
52 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
53 `deleted_at` timestamp NULL DEFAULT NULL,
54 PRIMARY KEY (`id`),
55 KEY `idx_deployment_id` (`deployment_id`)
56) ENGINE=InnoDB DEFAULT CHARSET=utf8;
57
58
59DROP TABLE IF EXISTS `deployments_versions`;
60CREATE TABLE `deployments_versions` (
61 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
62 `deployment_id` int(11) unsigned NOT NULL DEFAULT '0',
63 `app_version` varchar(14) NOT NULL DEFAULT '',
64 `current_package_id` int(10) unsigned NOT NULL DEFAULT '0',
65 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
66 `created_at` timestamp NULL DEFAULT NULL,
67 `deleted_at` timestamp NULL DEFAULT NULL,
68 PRIMARY KEY (`id`),
69 KEY `idx_did_appversion` (`deployment_id`,`app_version`)
70) ENGINE=InnoDB DEFAULT CHARSET=utf8;
71
72DROP TABLE IF EXISTS `packages`;
73CREATE TABLE `packages` (
74 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
75 `deployment_version_id` int(10) unsigned NOT NULL DEFAULT '0',
76 `deployment_id` int(10) unsigned NOT NULL DEFAULT '0',
77 `description` varchar(500) NOT NULL DEFAULT '',
78 `package_hash` varchar(64) NOT NULL DEFAULT '',
79 `blob_url` varchar(255) NOT NULL DEFAULT '',
80 `size` int(11) unsigned NOT NULL DEFAULT '0',
81 `manifest_blob_url` varchar(255) NOT NULL DEFAULT '',
82 `release_method` varchar(20) NOT NULL DEFAULT '',
83 `label` varchar(20) NOT NULL DEFAULT '',
84 `original_label` varchar(20) NOT NULL DEFAULT '',
85 `original_deployment` varchar(20) NOT NULL DEFAULT '',
86 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
87 `created_at` timestamp NULL DEFAULT NULL,
88 `released_by` bigint(20) unsigned NOT NULL DEFAULT '0',
89 `is_mandatory` tinyint(3) unsigned NOT NULL DEFAULT '0',
90 `is_disabled` tinyint(3) unsigned NOT NULL DEFAULT '0',
91 `rollout` tinyint(3) unsigned NOT NULL DEFAULT '0',
92 `deleted_at` timestamp NULL DEFAULT NULL,
93 PRIMARY KEY (`id`),
94 KEY `idx_deploymentid_label` (`deployment_id`,`label`(8)),
95 KEY `idx_versions_id` (`deployment_version_id`)
96) ENGINE=InnoDB DEFAULT CHARSET=utf8;
97
98DROP TABLE IF EXISTS `packages_diff`;
99CREATE TABLE `packages_diff` (
100 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
101 `package_id` int(11) unsigned NOT NULL DEFAULT '0',
102 `diff_against_package_hash` varchar(64) NOT NULL DEFAULT '',
103 `diff_blob_url` varchar(255) NOT NULL DEFAULT '',
104 `diff_size` int(11) unsigned NOT NULL DEFAULT '0',
105 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
106 `created_at` timestamp NULL DEFAULT NULL,
107 `deleted_at` timestamp NULL DEFAULT NULL,
108 PRIMARY KEY (`id`),
109 KEY `idx_packageid_hash` (`package_id`,`diff_against_package_hash`(40))
110) ENGINE=InnoDB DEFAULT CHARSET=utf8;
111
112DROP TABLE IF EXISTS `packages_metrics`;
113CREATE TABLE `packages_metrics` (
114 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
115 `package_id` int(10) unsigned NOT NULL DEFAULT '0',
116 `active` int(10) unsigned NOT NULL DEFAULT '0',
117 `downloaded` int(10) unsigned NOT NULL DEFAULT '0',
118 `failed` int(10) unsigned NOT NULL DEFAULT '0',
119 `installed` int(10) unsigned NOT NULL DEFAULT '0',
120 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
121 `created_at` timestamp NULL DEFAULT NULL,
122 `deleted_at` timestamp NULL DEFAULT NULL,
123 PRIMARY KEY (`id`),
124 KEY `idx_packageid` (`package_id`)
125) ENGINE=InnoDB DEFAULT CHARSET=utf8;
126
127DROP TABLE IF EXISTS `user_tokens`;
128CREATE TABLE `user_tokens` (
129 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
130 `uid` bigint(20) unsigned NOT NULL DEFAULT '0',
131 `name` varchar(50) NOT NULL DEFAULT '',
132 `tokens` varchar(64) NOT NULL DEFAULT '',
133 `created_by` varchar(64) NOT NULL DEFAULT '',
134 `description` varchar(500) NOT NULL DEFAULT '',
135 `is_session` tinyint(3) unsigned NOT NULL DEFAULT '0',
136 `expires_at` timestamp NULL DEFAULT NULL,
137 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
138 `deleted_at` timestamp NULL DEFAULT NULL,
139 PRIMARY KEY (`id`),
140 KEY `idx_uid` (`uid`),
141 KEY `idx_tokens` (`tokens`) KEY_BLOCK_SIZE=16
142) ENGINE=InnoDB DEFAULT CHARSET=utf8;
143
144DROP TABLE IF EXISTS `users`;
145CREATE TABLE `users` (
146 `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT,
147 `username` varchar(50) NOT NULL DEFAULT '',
148 `password` varchar(255) NOT NULL DEFAULT '',
149 `email` varchar(100) NOT NULL DEFAULT '',
150 `identical` varchar(10) NOT NULL DEFAULT '',
151 `ack_code` varchar(10) NOT NULL DEFAULT '',
152 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
153 `created_at` timestamp NULL DEFAULT NULL,
154 PRIMARY KEY (`id`),
155 UNIQUE KEY `udx_identical` (`identical`),
156 KEY `udx_username` (`username`),
157 KEY `idx_email` (`email`) KEY_BLOCK_SIZE=20
158) ENGINE=InnoDB DEFAULT CHARSET=utf8;
159
160INSERT INTO `users` (`id`, `username`, `password`, `email`, `identical`, `ack_code`, `updated_at`, `created_at`)
161VALUES
162 (1,'admin','$2a$12$mvUY9kTqW4kSoGuZFDW0sOSgKmNY8SPHVyVrSckBTLtXKf6vKX3W.','lisong2010@gmail.com','4ksvOXqog','oZmGE','2016-11-14 10:46:55','2016-02-29 21:24:49');
163
164
165DROP TABLE IF EXISTS `versions`;
166CREATE TABLE `versions` (
167 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
168 `type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '1.DBversion',
169 `version` varchar(10) NOT NULL DEFAULT '',
170 PRIMARY KEY (`id`),
171 UNIQUE KEY `udx_type` (`type`)
172) ENGINE=InnoDB DEFAULT CHARSET=utf8;
173
174LOCK TABLES `versions` WRITE;
175INSERT INTO `versions` (`id`, `type`, `version`)
176VALUES
177 (1,1,'0.3.0');
178UNLOCK TABLES;
179
180DROP TABLE IF EXISTS `log_report_deploy`;
181CREATE TABLE `log_report_deploy` (
182 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
183 `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
184 `package_id` int(10) unsigned NOT NULL DEFAULT '0',
185 `client_unique_id` varchar(100) NOT NULL DEFAULT '',
186 `previous_label` varchar(20) NOT NULL DEFAULT '',
187 `previous_deployment_key` varchar(64) NOT NULL DEFAULT '',
188 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
189 PRIMARY KEY (`id`)
190) ENGINE=InnoDB DEFAULT CHARSET=utf8;
191
192DROP TABLE IF EXISTS `log_report_download`;
193CREATE TABLE `log_report_download` (
194 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
195 `package_id` int(10) unsigned NOT NULL DEFAULT '0',
196 `client_unique_id` varchar(100) NOT NULL DEFAULT '',
197 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
198 PRIMARY KEY (`id`)
199) ENGINE=InnoDB DEFAULT CHARSET=utf8;