| @@ 797-838 (lines=42) @@ | ||
| 794 | * | |
| 795 | * @param Schema $schema | |
| 796 | */ | |
| 797 | public static function orocrmMagentoCustomerForeignKeys(Schema $schema) | |
| 798 |     { | |
| 799 | /** Generate foreign keys for table orocrm_magento_customer **/ | |
| 800 |         $table = $schema->getTable('orocrm_magento_customer'); | |
| 801 | $table->addForeignKeyConstraint( | |
| 802 |             $schema->getTable('oro_integration_channel'), | |
| 803 | ['channel_id'], | |
| 804 | ['id'], | |
| 805 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 806 | ); | |
| 807 | $table->addForeignKeyConstraint( | |
| 808 |             $schema->getTable('orocrm_magento_website'), | |
| 809 | ['website_id'], | |
| 810 | ['id'], | |
| 811 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 812 | ); | |
| 813 | $table->addForeignKeyConstraint( | |
| 814 |             $schema->getTable('orocrm_account'), | |
| 815 | ['account_id'], | |
| 816 | ['id'], | |
| 817 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 818 | ); | |
| 819 | $table->addForeignKeyConstraint( | |
| 820 |             $schema->getTable('orocrm_magento_store'), | |
| 821 | ['store_id'], | |
| 822 | ['id'], | |
| 823 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 824 | ); | |
| 825 | $table->addForeignKeyConstraint( | |
| 826 |             $schema->getTable('orocrm_magento_customer_group'), | |
| 827 | ['customer_group_id'], | |
| 828 | ['id'], | |
| 829 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 830 | ); | |
| 831 | $table->addForeignKeyConstraint( | |
| 832 |             $schema->getTable('orocrm_contact'), | |
| 833 | ['contact_id'], | |
| 834 | ['id'], | |
| 835 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 836 | ); | |
| 837 | /** End of generate foreign keys for table orocrm_magento_customer **/ | |
| 838 | } | |
| 839 | ||
| 840 | /** | |
| 841 | * Generate foreign keys for table orocrm_magento_customer_address | |
| @@ 923-964 (lines=42) @@ | ||
| 920 | * | |
| 921 | * @param Schema $schema | |
| 922 | */ | |
| 923 | public static function orocrmMagentoOrderForeignKeys(Schema $schema) | |
| 924 |     { | |
| 925 | /** Generate foreign keys for table orocrm_magento_order **/ | |
| 926 |         $table = $schema->getTable('orocrm_magento_order'); | |
| 927 | $table->addForeignKeyConstraint( | |
| 928 |             $schema->getTable('oro_integration_channel'), | |
| 929 | ['channel_id'], | |
| 930 | ['id'], | |
| 931 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 932 | ); | |
| 933 | $table->addForeignKeyConstraint( | |
| 934 |             $schema->getTable('oro_workflow_item'), | |
| 935 | ['workflow_item_id'], | |
| 936 | ['id'], | |
| 937 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 938 | ); | |
| 939 | $table->addForeignKeyConstraint( | |
| 940 |             $schema->getTable('orocrm_magento_cart'), | |
| 941 | ['cart_id'], | |
| 942 | ['id'], | |
| 943 | ['onDelete' => null, 'onUpdate' => null] | |
| 944 | ); | |
| 945 | $table->addForeignKeyConstraint( | |
| 946 |             $schema->getTable('oro_workflow_step'), | |
| 947 | ['workflow_step_id'], | |
| 948 | ['id'], | |
| 949 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 950 | ); | |
| 951 | $table->addForeignKeyConstraint( | |
| 952 |             $schema->getTable('orocrm_magento_customer'), | |
| 953 | ['customer_id'], | |
| 954 | ['id'], | |
| 955 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 956 | ); | |
| 957 | $table->addForeignKeyConstraint( | |
| 958 |             $schema->getTable('orocrm_magento_store'), | |
| 959 | ['store_id'], | |
| 960 | ['id'], | |
| 961 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 962 | ); | |
| 963 | /** End of generate foreign keys for table orocrm_magento_order **/ | |
| 964 | } | |
| 965 | ||
| 966 | /** | |
| 967 | * Generate foreign keys for table orocrm_magento_order_address | |
| @@ 81-120 (lines=40) @@ | ||
| 78 | * | |
| 79 | * @param Schema $schema | |
| 80 | */ | |
| 81 | protected function addOrocrmMagentoNewslSubscrForeignKeys(Schema $schema) | |
| 82 |     { | |
| 83 |         $table = $schema->getTable('orocrm_magento_newsl_subscr'); | |
| 84 | $table->addForeignKeyConstraint( | |
| 85 |             $schema->getTable('oro_organization'), | |
| 86 | ['organization_id'], | |
| 87 | ['id'], | |
| 88 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 89 | ); | |
| 90 | $table->addForeignKeyConstraint( | |
| 91 |             $schema->getTable('oro_user'), | |
| 92 | ['owner_id'], | |
| 93 | ['id'], | |
| 94 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 95 | ); | |
| 96 | $table->addForeignKeyConstraint( | |
| 97 |             $schema->getTable('orocrm_magento_customer'), | |
| 98 | ['customer_id'], | |
| 99 | ['id'], | |
| 100 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 101 | ); | |
| 102 | $table->addForeignKeyConstraint( | |
| 103 |             $schema->getTable('orocrm_magento_store'), | |
| 104 | ['store_id'], | |
| 105 | ['id'], | |
| 106 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 107 | ); | |
| 108 | $table->addForeignKeyConstraint( | |
| 109 |             $schema->getTable('oro_integration_channel'), | |
| 110 | ['channel_id'], | |
| 111 | ['id'], | |
| 112 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 113 | ); | |
| 114 | $table->addForeignKeyConstraint( | |
| 115 |             $schema->getTable('orocrm_channel'), | |
| 116 | ['data_channel_id'], | |
| 117 | ['id'], | |
| 118 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 119 | ); | |
| 120 | } | |
| 121 | } | |
| 122 | ||
| @@ 123-162 (lines=40) @@ | ||
| 120 | * | |
| 121 | * @param Schema $schema | |
| 122 | */ | |
| 123 | protected function addOrocrmSalesB2bCustomerForeignKeys(Schema $schema) | |
| 124 |     { | |
| 125 |         $table = $schema->getTable('orocrm_sales_b2bcustomer'); | |
| 126 | $table->addForeignKeyConstraint( | |
| 127 |             $schema->getTable('oro_user'), | |
| 128 | ['user_owner_id'], | |
| 129 | ['id'], | |
| 130 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 131 | ); | |
| 132 | $table->addForeignKeyConstraint( | |
| 133 |             $schema->getTable('oro_address'), | |
| 134 | ['shipping_address_id'], | |
| 135 | ['id'], | |
| 136 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 137 | ); | |
| 138 | $table->addForeignKeyConstraint( | |
| 139 |             $schema->getTable('orocrm_channel'), | |
| 140 | ['data_channel_id'], | |
| 141 | ['id'], | |
| 142 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 143 | ); | |
| 144 | $table->addForeignKeyConstraint( | |
| 145 |             $schema->getTable('oro_address'), | |
| 146 | ['billing_address_id'], | |
| 147 | ['id'], | |
| 148 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 149 | ); | |
| 150 | $table->addForeignKeyConstraint( | |
| 151 |             $schema->getTable('orocrm_account'), | |
| 152 | ['account_id'], | |
| 153 | ['id'], | |
| 154 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 155 | ); | |
| 156 | $table->addForeignKeyConstraint( | |
| 157 |             $schema->getTable('orocrm_contact'), | |
| 158 | ['contact_id'], | |
| 159 | ['id'], | |
| 160 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 161 | ); | |
| 162 | } | |
| 163 | } | |
| 164 | ||
| @@ 1432-1471 (lines=40) @@ | ||
| 1429 | * | |
| 1430 | * @param Schema $schema | |
| 1431 | */ | |
| 1432 | protected function addOrocrmMagentoNewslSubscrForeignKeys(Schema $schema) | |
| 1433 |     { | |
| 1434 |         $table = $schema->getTable('orocrm_magento_newsl_subscr'); | |
| 1435 | $table->addForeignKeyConstraint( | |
| 1436 |             $schema->getTable('oro_organization'), | |
| 1437 | ['organization_id'], | |
| 1438 | ['id'], | |
| 1439 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1440 | ); | |
| 1441 | $table->addForeignKeyConstraint( | |
| 1442 |             $schema->getTable('oro_user'), | |
| 1443 | ['owner_id'], | |
| 1444 | ['id'], | |
| 1445 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1446 | ); | |
| 1447 | $table->addForeignKeyConstraint( | |
| 1448 |             $schema->getTable('orocrm_magento_customer'), | |
| 1449 | ['customer_id'], | |
| 1450 | ['id'], | |
| 1451 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1452 | ); | |
| 1453 | $table->addForeignKeyConstraint( | |
| 1454 |             $schema->getTable('orocrm_magento_store'), | |
| 1455 | ['store_id'], | |
| 1456 | ['id'], | |
| 1457 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1458 | ); | |
| 1459 | $table->addForeignKeyConstraint( | |
| 1460 |             $schema->getTable('oro_integration_channel'), | |
| 1461 | ['channel_id'], | |
| 1462 | ['id'], | |
| 1463 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1464 | ); | |
| 1465 | $table->addForeignKeyConstraint( | |
| 1466 |             $schema->getTable('orocrm_channel'), | |
| 1467 | ['data_channel_id'], | |
| 1468 | ['id'], | |
| 1469 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 1470 | ); | |
| 1471 | } | |
| 1472 | ||
| 1473 | /** | |
| 1474 | * Enable activities | |
| @@ 517-557 (lines=41) @@ | ||
| 514 | * | |
| 515 | * @param Schema $schema | |
| 516 | */ | |
| 517 | protected function addOrocrmSalesFunnelForeignKeys(Schema $schema) | |
| 518 |     { | |
| 519 |         $table = $schema->getTable('orocrm_sales_funnel'); | |
| 520 | $table->addForeignKeyConstraint( | |
| 521 |             $schema->getTable('oro_user'), | |
| 522 | ['user_owner_id'], | |
| 523 | ['id'], | |
| 524 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 525 | ); | |
| 526 | $table->addForeignKeyConstraint( | |
| 527 |             $schema->getTable('orocrm_sales_opportunity'), | |
| 528 | ['opportunity_id'], | |
| 529 | ['id'], | |
| 530 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 531 | ); | |
| 532 | $table->addForeignKeyConstraint( | |
| 533 |             $schema->getTable('orocrm_sales_lead'), | |
| 534 | ['lead_id'], | |
| 535 | ['id'], | |
| 536 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 537 | ); | |
| 538 | $table->addForeignKeyConstraint( | |
| 539 |             $schema->getTable('oro_workflow_item'), | |
| 540 | ['workflow_item_id'], | |
| 541 | ['id'], | |
| 542 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 543 | ); | |
| 544 | $table->addForeignKeyConstraint( | |
| 545 |             $schema->getTable('oro_workflow_step'), | |
| 546 | ['workflow_step_id'], | |
| 547 | ['id'], | |
| 548 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] | |
| 549 | ); | |
| 550 | $table->addForeignKeyConstraint( | |
| 551 |             $schema->getTable('orocrm_channel'), | |
| 552 | ['data_channel_id'], | |
| 553 | ['id'], | |
| 554 | ['onDelete' => 'SET NULL', 'onUpdate' => null], | |
| 555 | 'FK_E20C7344BDC09B73' | |
| 556 | ); | |
| 557 | } | |
| 558 | ||
| 559 | /** | |
| 560 | * Add orocrm_sales_lead foreign keys. | |
| @@ 623-662 (lines=40) @@ | ||
| 620 | * | |
| 621 | * @param Schema $schema | |
| 622 | */ | |
| 623 | protected function addOrocrmSalesB2bCustomerForeignKeys(Schema $schema) | |
| 624 |     { | |
| 625 |         $table = $schema->getTable('orocrm_sales_b2bcustomer'); | |
| 626 | $table->addForeignKeyConstraint( | |
| 627 |             $schema->getTable('oro_user'), | |
| 628 | ['user_owner_id'], | |
| 629 | ['id'], | |
| 630 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 631 | ); | |
| 632 | $table->addForeignKeyConstraint( | |
| 633 |             $schema->getTable('oro_address'), | |
| 634 | ['shipping_address_id'], | |
| 635 | ['id'], | |
| 636 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 637 | ); | |
| 638 | $table->addForeignKeyConstraint( | |
| 639 |             $schema->getTable('orocrm_channel'), | |
| 640 | ['data_channel_id'], | |
| 641 | ['id'], | |
| 642 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 643 | ); | |
| 644 | $table->addForeignKeyConstraint( | |
| 645 |             $schema->getTable('oro_address'), | |
| 646 | ['billing_address_id'], | |
| 647 | ['id'], | |
| 648 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 649 | ); | |
| 650 | $table->addForeignKeyConstraint( | |
| 651 |             $schema->getTable('orocrm_account'), | |
| 652 | ['account_id'], | |
| 653 | ['id'], | |
| 654 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 655 | ); | |
| 656 | $table->addForeignKeyConstraint( | |
| 657 |             $schema->getTable('orocrm_contact'), | |
| 658 | ['contact_id'], | |
| 659 | ['id'], | |
| 660 | ['onDelete' => 'SET NULL', 'onUpdate' => null] | |
| 661 | ); | |
| 662 | } | |
| 663 | ||
| 664 | /** | |
| 665 | * Create oro_email_mailbox_processor table | |