Built motion from commit b33b832.|1.0.17
[motion.git] / server / migrations / 20170404155939-indexes.js
1 'use strict';
2
3 module.exports = {
4   up: function(queryInterface, Sequelize) {
5     return queryInterface.sequelize.query('set foreign_key_checks = 0')
6       .then(function() {
7         queryInterface.sequelize.query('DROP INDEX `analytics_default_metrics_name_unique` ON analytics_default_metrics;');
8       })
9       .catch(function(err) {
10         console.error(err);
11       })
12       .then(function() {
13         queryInterface.sequelize.query('DROP INDEX `analytics_metrics_name_unique` ON analytics_metrics;');
14       })
15       .catch(function(err) {
16         console.error(err);
17       })
18       .then(function() {
19         queryInterface.sequelize.query('DROP INDEX `chat_queues_name_unique` ON chat_queues;');
20       })
21       .catch(function(err) {
22         console.error(err);
23       })
24       .then(function() {
25         queryInterface.sequelize.query('DROP INDEX `chat_websites_address_unique` ON chat_websites;');
26       })
27       .catch(function(err) {
28         console.error(err);
29       })
30       .then(function() {
31         queryInterface.sequelize.query('DROP INDEX `cm_companies_name_unique` ON cm_companies;');
32       })
33       .catch(function(err) {
34         console.error(err);
35       })
36       .then(function() {
37         queryInterface.sequelize.query('DROP INDEX `cm_lists_name_unique` ON cm_lists;');
38       })
39       .catch(function(err) {
40         console.error(err);
41       })
42       .then(function() {
43         queryInterface.sequelize.query('DROP INDEX `dashboards_name_unique` ON dashboards;');
44       })
45       .catch(function(err) {
46         console.error(err);
47       })
48       .then(function() {
49         queryInterface.sequelize.query('DROP INDEX `fax_accounts_localstationid_unique` ON fax_accounts;');
50       })
51       .catch(function(err) {
52         console.error(err);
53       })
54       .then(function() {
55         queryInterface.sequelize.query('DROP INDEX `fax_queues_name_unique` ON fax_queues;');
56       })
57       .catch(function(err) {
58         console.error(err);
59       })
60       .then(function() {
61         queryInterface.sequelize.query('DROP INDEX `integrations_state_unique` ON integrations;');
62       })
63       .catch(function(err) {
64         console.error(err);
65       })
66       .then(function() {
67         queryInterface.sequelize.query('DROP INDEX `int_desk_accounts_remoteUri_unique` ON int_desk_accounts;');
68       })
69       .catch(function(err) {
70         console.error(err);
71       })
72       .then(function() {
73         queryInterface.sequelize.query('DROP INDEX `int_desk_accounts_username_unique` ON int_desk_accounts;');
74       })
75       .catch(function(err) {
76         console.error(err);
77       })
78       .then(function() {
79         queryInterface.sequelize.query('DROP INDEX `int_freshdesk_accounts_remoteUri_unique` ON int_freshdesk_accounts;');
80       })
81       .catch(function(err) {
82         console.error(err);
83       })
84       .then(function() {
85         queryInterface.sequelize.query('DROP INDEX `int_freshdesk_accounts_username_unique` ON int_freshdesk_accounts;');
86       })
87       .catch(function(err) {
88         console.error(err);
89       })
90       .then(function() {
91         queryInterface.sequelize.query('DROP INDEX `int_salesforce_accounts_username_unique` ON int_salesforce_accounts;');
92       })
93       .catch(function(err) {
94         console.error(err);
95       })
96       .then(function() {
97         queryInterface.sequelize.query('DROP INDEX `int_zendesk_accounts_remoteUri_unique` ON int_zendesk_accounts;');
98       })
99       .catch(function(err) {
100         console.error(err);
101       })
102       .then(function() {
103         queryInterface.sequelize.query('DROP INDEX `int_zendesk_accounts_username_unique` ON int_zendesk_accounts;');
104       })
105       .catch(function(err) {
106         console.error(err);
107       })
108       .then(function() {
109         queryInterface.sequelize.query('DROP INDEX `jscripty_projects_name_unique` ON jscripty_projects;');
110       })
111       .catch(function(err) {
112         console.error(err);
113       })
114       .then(function() {
115         queryInterface.sequelize.query('DROP INDEX `mail_accounts_address_unique` ON mail_accounts;');
116       })
117       .catch(function(err) {
118         console.error(err);
119       })
120       .then(function() {
121         queryInterface.sequelize.query('DROP INDEX `mail_queues_name_unique` ON mail_queues;');
122       })
123       .catch(function(err) {
124         console.error(err);
125       })
126       .then(function() {
127         queryInterface.sequelize.query('DROP INDEX `mail_servers_in_username_unique` ON mail_servers_in;');
128       })
129       .catch(function(err) {
130         console.error(err);
131       })
132       .then(function() {
133         queryInterface.sequelize.query('DROP INDEX `mail_servers_out_username_unique` ON mail_servers_out;');
134       })
135       .catch(function(err) {
136         console.error(err);
137       })
138       .then(function() {
139         queryInterface.sequelize.query('DROP INDEX `openchannel_queues_name_unique` ON openchannel_queues;');
140       })
141       .catch(function(err) {
142         console.error(err);
143       })
144       .then(function() {
145         queryInterface.sequelize.query('DROP INDEX `report_call_uniqueid_unique` ON report_call;');
146       })
147       .catch(function(err) {
148         console.error(err);
149       })
150       .then(function() {
151         queryInterface.sequelize.query('DROP INDEX `report_chat_connectid_unique` ON report_chat;');
152       })
153       .catch(function(err) {
154         console.error(err);
155       })
156       .then(function() {
157         queryInterface.sequelize.query('DROP INDEX `report_chat_room_uniqueid_unique` ON report_chat_room;');
158       })
159       .catch(function(err) {
160         console.error(err);
161       })
162       .then(function() {
163         queryInterface.sequelize.query('DROP INDEX `report_fax_connectid_unique` ON report_fax;');
164       })
165       .catch(function(err) {
166         console.error(err);
167       })
168       .then(function() {
169         queryInterface.sequelize.query('DROP INDEX `report_fax_room_uniqueid_unique` ON report_fax_room;');
170       })
171       .catch(function(err) {
172         console.error(err);
173       })
174       .then(function() {
175         queryInterface.sequelize.query('DROP INDEX `report_mail_connectid_unique` ON report_mail;');
176       })
177       .catch(function(err) {
178         console.error(err);
179       })
180       .then(function() {
181         queryInterface.sequelize.query('DROP INDEX `report_mail_room_uniqueid_unique` ON report_mail_room;');
182       })
183       .catch(function(err) {
184         console.error(err);
185       })
186       .then(function() {
187         queryInterface.sequelize.query('DROP INDEX `report_openchannel_connectid_unique` ON report_openchannel;');
188       })
189       .catch(function(err) {
190         console.error(err);
191       })
192       .then(function() {
193         queryInterface.sequelize.query('DROP INDEX `report_sms_connectid_unique` ON report_sms;');
194       })
195       .catch(function(err) {
196         console.error(err);
197       })
198       .then(function() {
199         queryInterface.sequelize.query('DROP INDEX `settings_min_internal_unique` ON settings;');
200       })
201       .catch(function(err) {
202         console.error(err);
203       })
204       .then(function() {
205         queryInterface.sequelize.query('DROP INDEX `settings_min_mailbox_unique` ON settings;');
206       })
207       .catch(function(err) {
208         console.error(err);
209       })
210       .then(function() {
211         queryInterface.sequelize.query('DROP INDEX `sms_accounts_phone_unique` ON sms_accounts;');
212       })
213       .catch(function(err) {
214         console.error(err);
215       })
216       .then(function() {
217         queryInterface.sequelize.query('DROP INDEX `sms_queues_name_unique` ON sms_queues;');
218       })
219       .catch(function(err) {
220         console.error(err);
221       })
222       .then(function() {
223         queryInterface.sequelize.query('DROP INDEX `square_odbc_name_unique` ON square_odbc;');
224       })
225       .catch(function(err) {
226         console.error(err);
227       })
228       .then(function() {
229         queryInterface.sequelize.query('DROP INDEX `square_projects_name_unique` ON square_projects;');
230       })
231       .catch(function(err) {
232         console.error(err);
233       })
234       .then(function() {
235         queryInterface.sequelize.query('DROP INDEX `teams_name_unique` ON teams;');
236       })
237       .catch(function(err) {
238         console.error(err);
239       })
240       .then(function() {
241         queryInterface.sequelize.query('DROP INDEX `tools_pauses_name_unique` ON tools_pauses;');
242       })
243       .catch(function(err) {
244         console.error(err);
245       })
246       .then(function() {
247         queryInterface.sequelize.query('DROP INDEX `tools_tags_name_unique` ON tools_tags;');
248       })
249       .catch(function(err) {
250         console.error(err);
251       })
252       .then(function() {
253         queryInterface.sequelize.query('DROP INDEX `tools_variables_name_unique` ON tools_variables;');
254       })
255       .catch(function(err) {
256         console.error(err);
257       })
258       .then(function() {
259         queryInterface.sequelize.query('DROP INDEX `voice_chanspy_prefix_unique` ON voice_chanspy;');
260       })
261       .catch(function(err) {
262         console.error(err);
263       })
264       .then(function() {
265         queryInterface.sequelize.query('DROP INDEX `voice_contexts_name_unique` ON voice_contexts;');
266       })
267       .catch(function(err) {
268         console.error(err);
269       })
270       .then(function() {
271         queryInterface.sequelize.query('DROP INDEX `voice_musiconhold_name_unique` ON voice_musiconhold;');
272       })
273       .catch(function(err) {
274         console.error(err);
275       })
276       .then(function() {
277         queryInterface.sequelize.query('DROP INDEX `voice_queues_name_unique` ON voice_queues;');
278       })
279       .catch(function(err) {
280         console.error(err);
281       })
282       .then(function() {
283         queryInterface.sequelize.query('DROP INDEX `mailbox_context` ON voice_voicemail;');
284       })
285       .catch(function(err) {
286         console.error(err);
287       })
288       .then(function() {
289         queryInterface.sequelize.query('set foreign_key_checks = 1');
290       })
291       .catch(function(err) {
292         console.error(err);
293       });
294   },
295
296   down: function(queryInterface, Sequelize) {
297     /*
298       Add reverting commands here.
299       Return a promise to correctly handle asynchronicity.
300
301       Example:
302       return queryInterface.dropTable('users');
303     */
304   }
305 };