· 9 years ago · Nov 14, 2016, 06:30 AM
1## Create clients list
2CREATE TABLE IF NOT EXISTS test.`migration_clients` (
3 `client_id` BIGINT(20) UNSIGNED NOT NULL
4);
5
6TRUNCATE TABLE test.`migration_clients`;
7INSERT INTO test.`migration_clients`
8SELECT DISTINCT
9 clients.`id`
10FROM
11 test.`clients`
12 LEFT JOIN test.`contacts` ON (contacts.`client_id`=clients.`id`)
13 JOIN test.`client_groups` ON (client_groups.`id`=clients.`client_group_id`)
14 JOIN test.`companies` ON (companies.`id`=client_groups.`company_id`)
15WHERE 1
16 AND client_groups.`name` != 'TEST'
17 AND companies.`name`='TVBOXPLUS'
18;
19
20
21
22
23
24## Company
25UPDATE
26 blesta.`companies` AS blesta_companies
27 JOIN test.`companies` migration_companies ON (migration_companies.`name`='TVBOXPLUS')
28SET
29 blesta_companies.`name`=migration_companies.`name`,
30 blesta_companies.`hostname`=migration_companies.`hostname`,
31 blesta_companies.`address`=migration_companies.`address`,
32 blesta_companies.`phone`=migration_companies.`phone`,
33 blesta_companies.`fax`=migration_companies.`fax`
34WHERE blesta_companies.`id`='1'
35;
36
37TRUNCATE TABLE blesta.`company_settings`;
38INSERT INTO blesta.`company_settings`
39SELECT
40 company_settings.`key`,
41 '1' AS 'company_id',
42 company_settings.`value`,
43 company_settings.`encrypted`,
44 company_settings.`inherit`
45FROM
46 test.`company_settings`
47 JOIN test.`companies` ON (companies.`id`=company_settings.`company_id`)
48WHERE 1
49 AND companies.`name`='TVBOXPLUS'
50
51
52
53
54
55## Clients
56
57# client_values - пуÑтаÑ
58# client_notes - не переноÑить
59# client_group_settings - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых групп
60# client_fileds - пуÑтаÑ
61# client_documents - не переноÑить
62
63TRUNCATE TABLE blesta.`clients`;
64INSERT INTO blesta.`clients`
65SELECT clients.*
66FROM test.`clients`
67JOIN test.`migration_clients` ON (migration_clients.`client_id`=clients.`id`)
68;
69INSERT INTO blesta.`client_settings`
70SELECT client_settings.*
71FROM test.`client_settings`
72JOIN test.`migration_clients` ON (migration_clients.`client_id`=client_settings.`client_id`)
73;
74INSERT INTO blesta.`client_packages`
75SELECT client_packages.*
76FROM test.`client_packages`
77JOIN test.`migration_clients` ON (migration_clients.`client_id`=client_packages.`client_id`)
78;
79INSERT INTO blesta.`client_groups`
80SELECT DISTINCT
81 client_groups.`id`,
82 '1' AS 'company_id',
83 client_groups.`name`,
84 client_groups.`description`,
85 client_groups.`color`
86FROM
87 test.`client_groups`
88 JOIN test.`companies` ON (companies.`id`=client_groups.`company_id`)
89 JOIN test.`clients` ON (clients.`client_group_id`=client_groups.`id`)
90 JOIN test.`migration_clients` ON (migration_clients.`client_id`=clients.`id`)
91WHERE 1
92 AND companies.`name`='TVBOXPLUS'
93 AND client_groups.`name` != 'TEST'
94;
95INSERT INTO blesta.`client_account`
96SELECT DISTINCT client_account.*
97FROM
98 test.`client_account`
99 JOIN test.`migration_clients` ON (migration_clients.`client_id`=client_account.`client_id`)
100;
101
102
103
104
105## Contacts
106# contact_types - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых компаний
107TRUNCATE TABLE blesta.`contacts`;
108INSERT INTO blesta.`contacts`
109SELECT contacts.*
110FROM
111 test.`contacts`
112 JOIN test.`migration_clients` ON (migration_clients.`client_id`=contacts.`client_id`)
113;
114INSERT INTO blesta.`contact_permissions`
115SELECT contact_permissions.*
116FROM
117 test.`contact_permissions`
118 JOIN test.`contacts` ON (contacts.`id`=contact_permissions.`contact_id`)
119 JOIN test.`migration_clients` ON (migration_clients.`client_id`=contacts.`client_id`)
120;
121INSERT INTO blesta.`contact_numbers`
122SELECT contact_numbers.*
123FROM
124 test.`contact_numbers`
125 JOIN test.`contacts` ON (contacts.`id`=contact_numbers.`contact_id`)
126 JOIN test.`migration_clients` ON (migration_clients.`client_id`=contacts.`client_id`)
127;
128
129
130
131## Accounts
132# accounts_ach - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых контактов
133TRUNCATE blesta.`accounts_cc`;
134INSERT INTO blesta.`accounts_cc`
135SELECT accounts_cc.*
136FROM
137 test.`accounts_cc`
138 JOIN test.`contacts` ON (contacts.`id`=accounts_cc.`contact_id`)
139 JOIN test.`migration_clients` ON (migration_clients.`client_id`=contacts.`client_id`)
140;
141
142
143
144## Modules
145# module_row_groups - пуÑтаÑ
146# module_groups - пуÑтаÑ
147# module_client_meta - пуÑтаÑ
148
149TRUNCATE TABLE blesta.`modules`;
150INSERT INTO blesta.`modules`
151SELECT
152 modules.`id`,
153 '1' AS 'company_id',
154 modules.`name`,
155 modules.`class`,
156 modules.`version`
157FROM
158 test.`modules`
159 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
160WHERE 1
161 AND companies.`name`='TVBOXPLUS'
162;
163
164TRUNCATE TABLE blesta.`module_rows`;
165INSERT INTO blesta.`module_rows`
166SELECT module_rows.*
167FROM
168 test.`module_rows`
169 JOIN test.`modules` ON (modules.`id`=module_rows.`module_id`)
170 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
171WHERE 1
172 AND companies.`name`='TVBOXPLUS'
173;
174TRUNCATE TABLE blesta.`module_row_meta`;
175INSERT INTO blesta.`module_row_meta`
176SELECT module_row_meta.*
177FROM
178 test.`module_row_meta`
179 JOIN test.`module_rows` ON (module_rows.`id`=module_row_meta.`module_row_id`)
180 JOIN test.`modules` ON (modules.`id`=module_rows.`module_id`)
181 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
182WHERE 1
183 AND companies.`name`='TVBOXPLUS'
184;
185TRUNCATE TABLE blesta.`module_meta`;
186INSERT INTO blesta.`module_meta`
187SELECT module_meta.*
188FROM
189 test.`module_meta`
190 JOIN test.`modules` ON (modules.`id`=module_meta.`module_id`)
191 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
192WHERE 1
193 AND companies.`name`='TVBOXPLUS'
194;
195
196
197
198## Packages
199# package_options- пуÑтаÑ
200# package_option_values - пуÑтаÑ
201# package_option_pricing - пуÑтаÑ
202# package_option_groups - пуÑтаÑ
203# package_option_group - пуÑтаÑ
204# package_option - пуÑтаÑ
205# package_meta - пуÑтаÑ
206
207TRUNCATE TABLE blesta.`packages`;
208-- DELETE FROM blesta.`packages` WHERE `id` NOT IN ('1','2','3');
209INSERT INTO blesta.`packages`
210SELECT
211 packages.`id`,
212 packages.`id_format`,
213 packages.`id_value`,
214 packages.`module_id`,
215 packages.`name`,
216 packages.`description`,
217 packages.`description_html`,
218 packages.`qty`,
219 packages.`module_row`,
220 packages.`module_group`,
221 packages.`taxable`,
222 packages.`single_term`,
223 packages.`status`,
224 '1' AS 'company_id',
225 packages.`prorata_day`,
226 packages.`prorata_cutoff`
227FROM
228 test.`packages`
229 JOIN test.`modules` ON (modules.`id`=packages.`module_id`)
230 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
231WHERE 1
232 AND companies.`name`='TVBOXPLUS'
233;
234INSERT INTO blesta.`package_pricing`
235SELECT package_pricing.*
236FROM
237 test.`package_pricing`
238 JOIN test.`packages` ON (packages.`id`=package_pricing.`package_id`)
239 JOIN test.`modules` ON (modules.`id`=packages.`module_id`)
240 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
241WHERE 1
242 AND companies.`name`='TVBOXPLUS'
243;
244
245INSERT INTO blesta.`package_groups`
246SELECT
247 package_groups.`id`,
248 package_groups.`name`,
249 package_groups.`description`,
250 package_groups.`type`,
251 '1' AS 'company_id',
252 package_groups.`allow_upgrades`
253FROM
254 test.`package_groups`
255 JOIN test.`companies` ON (companies.`id`=package_groups.`company_id`)
256WHERE 1
257 AND companies.`name`='TVBOXPLUS'
258;
259INSERT INTO blesta.`package_group_parents`
260SELECT package_group_parents.*
261FROM
262 test.`package_group_parents`
263 JOIN test.`package_groups` ON (package_groups.`id`=package_group_parents.`group_id`)
264 JOIN test.`companies` ON (companies.`id`=package_groups.`company_id`)
265WHERE 1
266 AND companies.`name`='TVBOXPLUS'
267;
268INSERT INTO blesta.`package_group`
269SELECT package_group.*
270FROM
271 test.`package_group`
272 JOIN test.`package_groups` ON (package_groups.`id`=package_group.`package_group_id`)
273 JOIN test.`companies` ON (companies.`id`=package_groups.`company_id`)
274WHERE 1
275 AND companies.`name`='TVBOXPLUS'
276;
277INSERT INTO blesta.`package_emails`
278SELECT package_emails.*
279FROM
280 test.`package_emails`
281 JOIN test.`packages` ON (packages.`id`=package_emails.`package_id`)
282 JOIN test.`modules` ON (modules.`id`=packages.`module_id`)
283 JOIN test.`companies` ON (companies.`id`=modules.`company_id`)
284WHERE 1
285 AND companies.`name`='TVBOXPLUS'
286;
287
288
289
290
291
292## Pricings
293INSERT INTO blesta.`pricings`
294SELECT
295 pricings.`id`,
296 '1' AS 'company_id',
297 pricings.`term`,
298 pricings.`period`,
299 pricings.`price`,
300 pricings.`setup_fee`,
301 pricings.`cancel_fee`,
302 pricings.`currency`
303FROM
304 test.`pricings`
305 JOIN test.`companies` ON (companies.`id`=pricings.`company_id`)
306WHERE 1
307 AND companies.`name`='TVBOXPLUS'
308;
309
310
311
312
313## Services
314# service_options - пуÑтаÑ
315
316INSERT INTO blesta.`services`
317SELECT
318 services.*
319FROM
320 test.`services`
321 JOIN test.`migration_clients` ON (migration_clients.`client_id`=services.`client_id`)
322;
323
324INSERT INTO blesta.`service_fields`
325SELECT
326 service_fields.*
327FROM
328 test.`service_fields`
329 JOIN test.`services` ON (services.`id`=service_fields.`service_id`)
330 JOIN test.`migration_clients` ON (migration_clients.`client_id`=services.`client_id`)
331;
332INSERT INTO blesta.`service_changes`
333SELECT
334 service_changes.*
335FROM
336 test.`service_changes`
337 JOIN test.`services` ON (services.`id`=service_changes.`service_id`)
338 JOIN test.`migration_clients` ON (migration_clients.`client_id`=services.`client_id`)
339;
340
341
342
343
344
345## Users
346INSERT INTO blesta.`users`
347SELECT users.*
348FROM
349 test.`users`
350 JOIN test.`clients` ON (clients.`user_id`=users.`id`)
351 JOIN test.`migration_clients` ON (migration_clients.`client_id`=clients.`id`)
352;
353INSERT INTO blesta.`users`
354SELECT users.*
355FROM
356 test.`users`
357WHERE username='vetal'
358;
359INSERT INTO blesta.`staff`
360SELECT * FROM test.staff
361WHERE user_id=4209
362;
363INSERT INTO `users`(`id`,`username`,`password`,`two_factor_mode`,`two_factor_key`,`two_factor_pin`,`date_added`) VALUES (2,'oleg','$2a$12$v/R1deqXLZxO2fn9HEWhfe2jFTzWS8UFVWFO.oxHFeiU3ZjJ2jV4a','none','c062a1e259fe789d8a89989618e1c669fe75e2f6','','2016-01-20 20:19:06')
364;
365INSERT INTO blesta.`users`(`id`, `username`,`password`,`two_factor_mode`,`two_factor_key`,`two_factor_pin`,`date_added`) VALUES (NULL, 'lawserge','$2a$12$7KHarX.txK/UwgpYI/F27ORGaOBSx4n3V1GSMe5.R13x9FzdNoUWe','none','c062a1e259fe789d8a89989618e1c669fe75e2f6','','2016-01-20 20:19:06'),(NULL,'peter@axsit.ca','$2a$12$eHUEzHXQ4Zd0EP.ipx8vE.Ny2rw6UlJHYdafXB/FIyagvqp2O7yUm','none',NULL,NULL,'2016-01-27 20:26:23');
366;
367SELECT * FROM clients WHERE user_id=2
368;
369SELECT * FROM blesta.`users` u
370WHERE u.`username`='peter@axsit.ca'
371
372
373## CMS Pages
374TRUNCATE TABLE blesta.`cms_pages`;
375INSERT INTO blesta.`cms_pages`
376SELECT
377 cms_pages.`uri`,
378 '1' AS 'company_id',
379 cms_pages.`title`,
380 cms_pages.`content`
381FROM
382 test.`cms_pages`
383 JOIN test.`companies` ON (companies.`id`=cms_pages.`company_id`)
384WHERE 1
385 AND companies.`name`='TVBOXPLUS'
386;
387
388
389
390
391## Currencies
392TRUNCATE TABLE blesta.`currencies`;
393INSERT INTO blesta.`currencies`
394SELECT
395 currencies.`code`,
396 '1' AS 'company_id',
397 currencies.`format`,
398 currencies.`precision`,
399 currencies.`prefix`,
400 currencies.`suffix`,
401 currencies.`exchange_rate`,
402 currencies.`exchange_updated`
403FROM
404 test.`currencies`
405 JOIN test.`companies` ON (companies.`id`=currencies.`company_id`)
406WHERE 1
407 AND companies.`name`='TVBOXPLUS'
408;
409
410
411
412
413
414## Emails
415TRUNCATE TABLE blesta.`emails`;
416INSERT INTO blesta.`emails`
417SELECT
418 emails.`id`,
419 emails.`email_group_id`,
420 '1' AS 'company_id',
421 emails.`lang`,
422 emails.`from`,
423 emails.`from_name`,
424 emails.`subject`,
425 emails.`text`,
426 emails.`html`,
427 emails.`email_signature_id`,
428 emails.`include_attachments`,
429 emails.`status`
430FROM
431 test.`emails`
432 JOIN test.`companies` ON (companies.`id`=emails.`company_id`)
433WHERE 1
434 AND companies.`name`='TVBOXPLUS'
435;
436
437TRUNCATE TABLE blesta.`email_signatures`;
438INSERT INTO blesta.`email_signatures`
439SELECT
440 email_signatures.`id`,
441 '1' AS 'company_id',
442 email_signatures.`name`,
443 email_signatures.`text`,
444 email_signatures.`html`
445FROM
446 test.`email_signatures`
447 JOIN test.`companies` ON (companies.`id`=email_signatures.`company_id`)
448WHERE 1
449 AND companies.`name`='TVBOXPLUS'
450;
451
452
453
454
455## Plugins
456TRUNCATE TABLE blesta.`plugins`;
457INSERT INTO blesta.`plugins`
458SELECT
459 plugins.`id`,
460 plugins.`dir`,
461 '1' AS 'company_id',
462 plugins.`name`,
463 plugins.`version`,
464 plugins.`enabled`
465FROM
466 test.`plugins`
467 JOIN test.`companies` ON (companies.`id`=plugins.`company_id`)
468WHERE 1
469 AND companies.`name`='TVBOXPLUS'
470;
471
472TRUNCATE TABLE blesta.`plugin_events`;
473INSERT INTO blesta.`plugin_events`
474SELECT plugin_events.*
475FROM
476 test.`plugin_events`
477 JOIN test.`plugins` ON (plugins.`id`=plugin_events.`plugin_id`)
478 JOIN test.`companies` ON (companies.`id`=plugins.`company_id`)
479WHERE 1
480 AND companies.`name`='TVBOXPLUS'
481;
482
483TRUNCATE TABLE blesta.`plugin_actions`;
484INSERT INTO blesta.`plugin_actions`
485SELECT plugin_actions.*
486FROM
487 test.`plugin_actions`
488 JOIN test.`plugins` ON (plugins.`id`=plugin_actions.`plugin_id`)
489 JOIN test.`companies` ON (companies.`id`=plugins.`company_id`)
490WHERE 1
491 AND companies.`name`='TVBOXPLUS'
492
493
494
495
496## Support
497TRUNCATE TABLE blesta.`support_tickets`;
498INSERT INTO blesta.`support_tickets`
499SELECT support_tickets.*
500FROM
501 test.`support_tickets`
502 JOIN test.`migration_clients` ON (migration_clients.`client_id`=support_tickets.`client_id`)
503;
504UPDATE blesta.`support_tickets` SET
505 `staff_id`=NULL,
506 `department_id`='1'
507;
508
509TRUNCATE TABLE blesta.`support_responses`;
510INSERT INTO blesta.`support_responses`
511SELECT
512 support_responses.*
513FROM
514 test.`support_responses`
515 JOIN test.`support_response_categories` ON (support_responses.`category_id`=support_response_categories.`id`)
516 JOIN test.`companies` ON (companies.`id`=support_response_categories.`company_id`)
517WHERE 1
518 AND companies.`name`='TVBOXPLUS'
519;
520
521TRUNCATE TABLE blesta.`support_response_categories`;
522INSERT INTO blesta.`support_response_categories`
523SELECT
524 support_response_categories.`id`,
525 '1' AS 'company_id',
526 support_response_categories.`parent_id`,
527 support_response_categories.`name`
528FROM
529 test.`support_response_categories`
530 JOIN test.`companies` ON (companies.`id`=support_response_categories.`company_id`)
531WHERE 1
532 AND companies.`name`='TVBOXPLUS'
533;
534
535TRUNCATE TABLE blesta.`support_replies`;
536INSERT INTO blesta.`support_replies`
537SELECT
538 support_replies.`id`,
539 support_replies.`ticket_id`,
540 NULL AS 'staff_id',
541 support_replies.`contact_id`,
542 support_replies.`type`,
543 support_replies.`details`,
544 support_replies.`date_added`
545FROM
546 test.`support_replies`
547 JOIN test.`support_tickets` ON (support_tickets.`id`=support_replies.`ticket_id`)
548 JOIN test.`migration_clients` ON (migration_clients.`client_id`=support_tickets.`client_id`)
549;
550TRUNCATE TABLE blesta.`support_departments`;
551INSERT INTO blesta.`support_departments`
552SELECT
553 support_departments.`id`,
554 '1' AS 'company_id',
555 support_departments.`name`,
556 support_departments.`description`,
557 support_departments.`email`,
558 support_departments.`method`,
559 support_departments.`default_priority`,
560 support_departments.`host`,
561 support_departments.`user`,
562 support_departments.`pass`,
563 support_departments.`port`,
564 support_departments.`security`,
565 support_departments.`box_name`,
566 support_departments.`mark_messages`,
567 support_departments.`clients_only`,
568 support_departments.`override_from_email`,
569 support_departments.`close_ticket_interval`,
570 support_departments.`response_id`,
571 support_departments.`status`
572FROM
573 test.`support_departments`
574 JOIN test.`companies` ON (companies.`id`=support_departments.`company_id`)
575WHERE 1
576 AND companies.`name`='TVBOXPLUS'
577;
578
579
580
581
582## Taxes
583TRUNCATE TABLE blesta.`taxes`;
584INSERT INTO blesta.`taxes`
585SELECT
586 taxes.`id`,
587 '1' AS 'company_id',
588 taxes.`level`,
589 taxes.`name`,
590 taxes.`amount`,
591 taxes.`type`,
592 taxes.`country`,
593 taxes.`state`,
594 taxes.`status`
595FROM
596 test.`taxes`
597 JOIN test.`companies` ON (companies.`id`=taxes.`company_id`)
598WHERE 1
599 AND companies.`name`='TVBOXPLUS'
600;
601
602
603
604
605
606## Themss
607TRUNCATE TABLE blesta.`themes`;
608INSERT INTO blesta.`themes`
609SELECT
610 themes.`id`,
611 '1' AS 'company_id',
612 themes.`name`,
613 themes.`type`,
614 themes.`data`
615FROM
616 test.`themes`
617 JOIN test.`companies` ON (companies.`id`=themes.`company_id`)
618WHERE 1
619 AND companies.`name`='TVBOXPLUS'
620;
621
622
623
624## Transactions
625TRUNCATE TABLE blesta.`transactions`;
626INSERT INTO blesta.`transactions`
627SELECT transactions.*
628FROM
629 test.`transactions`
630 JOIN test.`migration_clients` ON (migration_clients.`client_id`=transactions.`client_id`)
631;
632
633TRUNCATE TABLE blesta.`transaction_types`;
634INSERT INTO blesta.`transaction_types`
635SELECT transaction_types.* FROM test.`transaction_types`
636;
637
638TRUNCATE TABLE blesta.`transaction_applied`;
639INSERT INTO blesta.`transaction_applied`
640SELECT transaction_applied.*
641FROM
642 test.`transaction_applied`
643 JOIN test.`transactions` ON (transactions.`id`=transaction_applied.`transaction_id`)
644 JOIN test.`migration_clients` ON (migration_clients.`client_id`=transactions.`client_id`)
645;
646
647
648
649
650## Gateways
651TRUNCATE TABLE blesta.`gateways`;
652INSERT INTO blesta.`gateways`
653SELECT
654 gateways.`id`,
655 '1' AS 'company_id',
656 gateways.`name`,
657 gateways.`class`,
658 gateways.`version`,
659 gateways.`type`
660FROM
661 test.`gateways`
662 JOIN test.`companies` ON (companies.`id`=gateways.`company_id`)
663WHERE 1
664 AND companies.`name`='TVBOXPLUS'
665;
666
667TRUNCATE TABLE blesta.`gateway_meta`;
668INSERT INTO blesta.`gateway_meta`
669SELECT gateway_meta.*
670FROM
671 test.`gateway_meta`
672 JOIN test.`gateways` ON (gateways.`id`=gateway_meta.`gateway_id`)
673 JOIN test.`companies` ON (companies.`id`=gateways.`company_id`)
674WHERE 1
675 AND companies.`name`='TVBOXPLUS'
676;
677
678
679
680
681## Invoices
682# invoices_recur - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых клиентов
683# invoices_recur_created - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых клиентов
684# invoice_values - пуÑтаÑ
685# invoice_recur_values - пуÑтаÑ
686# invoice_recur_lines - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых клиентов
687# invoice_recur_delivery - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых клиентов
688# invoice_meta - нет запиÑей Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ½Ð¾Ñимых клиентов
689# invoice_fields - пуÑтаÑ
690
691TRUNCATE TABLE blesta.`invoices`;
692INSERT INTO blesta.`invoices`
693SELECT invoices.*
694FROM
695 test.`invoices`
696 JOIN test.`migration_clients` ON (migration_clients.`client_id`=invoices.`client_id`)
697;
698
699TRUNCATE TABLE blesta.`invoice_lines`;
700INSERT INTO blesta.`invoice_lines`
701SELECT invoice_lines.*
702FROM
703 test.`invoice_lines`
704 JOIN test.`invoices` ON (invoices.`id`=invoice_lines.`invoice_id`)
705 JOIN test.`migration_clients` ON (migration_clients.`client_id`=invoices.`client_id`)
706;
707
708TRUNCATE TABLE blesta.`invoice_line_taxes`;
709INSERT INTO blesta.`invoice_line_taxes`
710SELECT invoice_line_taxes.*
711FROM
712 test.`invoice_line_taxes`
713 JOIN test.`invoice_lines` ON (invoice_lines.`id`=invoice_line_taxes.`line_id`)
714 JOIN test.`invoices` ON (invoices.`id`=invoice_lines.`invoice_id`)
715 JOIN test.`migration_clients` ON (migration_clients.`client_id`=invoices.`client_id`)
716;
717
718TRUNCATE TABLE blesta.`invoice_delivery`;
719INSERT INTO blesta.`invoice_delivery`
720SELECT invoice_delivery.*
721FROM
722 test.`invoice_delivery`
723 JOIN test.`invoices` ON (invoices.`id`=invoice_delivery.`invoice_id`)
724 JOIN test.`migration_clients` ON (migration_clients.`client_id`=invoices.`client_id`)
725;