| @@ 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 | ||
| @@ 492-532 (lines=41) @@ | ||
| 489 | * |
|
| 490 | * @param Schema $schema |
|
| 491 | */ |
|
| 492 | protected function addOrocrmSalesFunnelForeignKeys(Schema $schema) |
|
| 493 | { |
|
| 494 | $table = $schema->getTable('orocrm_sales_funnel'); |
|
| 495 | $table->addForeignKeyConstraint( |
|
| 496 | $schema->getTable('oro_user'), |
|
| 497 | ['user_owner_id'], |
|
| 498 | ['id'], |
|
| 499 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 500 | ); |
|
| 501 | $table->addForeignKeyConstraint( |
|
| 502 | $schema->getTable('orocrm_sales_opportunity'), |
|
| 503 | ['opportunity_id'], |
|
| 504 | ['id'], |
|
| 505 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 506 | ); |
|
| 507 | $table->addForeignKeyConstraint( |
|
| 508 | $schema->getTable('orocrm_sales_lead'), |
|
| 509 | ['lead_id'], |
|
| 510 | ['id'], |
|
| 511 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 512 | ); |
|
| 513 | $table->addForeignKeyConstraint( |
|
| 514 | $schema->getTable('oro_workflow_item'), |
|
| 515 | ['workflow_item_id'], |
|
| 516 | ['id'], |
|
| 517 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 518 | ); |
|
| 519 | $table->addForeignKeyConstraint( |
|
| 520 | $schema->getTable('oro_workflow_step'), |
|
| 521 | ['workflow_step_id'], |
|
| 522 | ['id'], |
|
| 523 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 524 | ); |
|
| 525 | $table->addForeignKeyConstraint( |
|
| 526 | $schema->getTable('orocrm_channel'), |
|
| 527 | ['data_channel_id'], |
|
| 528 | ['id'], |
|
| 529 | ['onDelete' => 'SET NULL', 'onUpdate' => null], |
|
| 530 | 'FK_E20C7344BDC09B73' |
|
| 531 | ); |
|
| 532 | } |
|
| 533 | ||
| 534 | /** |
|
| 535 | * Add orocrm_sales_lead foreign keys. |
|
| @@ 604-643 (lines=40) @@ | ||
| 601 | * |
|
| 602 | * @param Schema $schema |
|
| 603 | */ |
|
| 604 | protected function addOrocrmSalesB2bCustomerForeignKeys(Schema $schema) |
|
| 605 | { |
|
| 606 | $table = $schema->getTable('orocrm_sales_b2bcustomer'); |
|
| 607 | $table->addForeignKeyConstraint( |
|
| 608 | $schema->getTable('oro_user'), |
|
| 609 | ['user_owner_id'], |
|
| 610 | ['id'], |
|
| 611 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 612 | ); |
|
| 613 | $table->addForeignKeyConstraint( |
|
| 614 | $schema->getTable('oro_address'), |
|
| 615 | ['shipping_address_id'], |
|
| 616 | ['id'], |
|
| 617 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 618 | ); |
|
| 619 | $table->addForeignKeyConstraint( |
|
| 620 | $schema->getTable('orocrm_channel'), |
|
| 621 | ['data_channel_id'], |
|
| 622 | ['id'], |
|
| 623 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 624 | ); |
|
| 625 | $table->addForeignKeyConstraint( |
|
| 626 | $schema->getTable('oro_address'), |
|
| 627 | ['billing_address_id'], |
|
| 628 | ['id'], |
|
| 629 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 630 | ); |
|
| 631 | $table->addForeignKeyConstraint( |
|
| 632 | $schema->getTable('orocrm_account'), |
|
| 633 | ['account_id'], |
|
| 634 | ['id'], |
|
| 635 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 636 | ); |
|
| 637 | $table->addForeignKeyConstraint( |
|
| 638 | $schema->getTable('orocrm_contact'), |
|
| 639 | ['contact_id'], |
|
| 640 | ['id'], |
|
| 641 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 642 | ); |
|
| 643 | } |
|
| 644 | ||
| 645 | /** |
|
| 646 | * Create oro_email_mailbox_processor table |
|
| @@ 122-161 (lines=40) @@ | ||
| 119 | * |
|
| 120 | * @param Schema $schema |
|
| 121 | */ |
|
| 122 | protected function addOrocrmSalesB2bCustomerForeignKeys(Schema $schema) |
|
| 123 | { |
|
| 124 | $table = $schema->getTable('orocrm_sales_b2bcustomer'); |
|
| 125 | $table->addForeignKeyConstraint( |
|
| 126 | $schema->getTable('oro_user'), |
|
| 127 | ['user_owner_id'], |
|
| 128 | ['id'], |
|
| 129 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 130 | ); |
|
| 131 | $table->addForeignKeyConstraint( |
|
| 132 | $schema->getTable('oro_address'), |
|
| 133 | ['shipping_address_id'], |
|
| 134 | ['id'], |
|
| 135 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 136 | ); |
|
| 137 | $table->addForeignKeyConstraint( |
|
| 138 | $schema->getTable('orocrm_channel'), |
|
| 139 | ['data_channel_id'], |
|
| 140 | ['id'], |
|
| 141 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 142 | ); |
|
| 143 | $table->addForeignKeyConstraint( |
|
| 144 | $schema->getTable('oro_address'), |
|
| 145 | ['billing_address_id'], |
|
| 146 | ['id'], |
|
| 147 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 148 | ); |
|
| 149 | $table->addForeignKeyConstraint( |
|
| 150 | $schema->getTable('orocrm_account'), |
|
| 151 | ['account_id'], |
|
| 152 | ['id'], |
|
| 153 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 154 | ); |
|
| 155 | $table->addForeignKeyConstraint( |
|
| 156 | $schema->getTable('orocrm_contact'), |
|
| 157 | ['contact_id'], |
|
| 158 | ['id'], |
|
| 159 | ['onDelete' => 'SET NULL', 'onUpdate' => null] |
|
| 160 | ); |
|
| 161 | } |
|
| 162 | } |
|
| 163 | ||
| @@ 1492-1531 (lines=40) @@ | ||
| 1489 | * |
|
| 1490 | * @param Schema $schema |
|
| 1491 | */ |
|
| 1492 | protected function addOrocrmMagentoNewslSubscrForeignKeys(Schema $schema) |
|
| 1493 | { |
|
| 1494 | $table = $schema->getTable('orocrm_magento_newsl_subscr'); |
|
| 1495 | $table->addForeignKeyConstraint( |
|
| 1496 | $schema->getTable('oro_organization'), |
|
| 1497 | ['organization_id'], |
|
| 1498 | ['id'], |
|
| 1499 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1500 | ); |
|
| 1501 | $table->addForeignKeyConstraint( |
|
| 1502 | $schema->getTable('oro_user'), |
|
| 1503 | ['owner_id'], |
|
| 1504 | ['id'], |
|
| 1505 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1506 | ); |
|
| 1507 | $table->addForeignKeyConstraint( |
|
| 1508 | $schema->getTable('orocrm_magento_customer'), |
|
| 1509 | ['customer_id'], |
|
| 1510 | ['id'], |
|
| 1511 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1512 | ); |
|
| 1513 | $table->addForeignKeyConstraint( |
|
| 1514 | $schema->getTable('orocrm_magento_store'), |
|
| 1515 | ['store_id'], |
|
| 1516 | ['id'], |
|
| 1517 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1518 | ); |
|
| 1519 | $table->addForeignKeyConstraint( |
|
| 1520 | $schema->getTable('oro_integration_channel'), |
|
| 1521 | ['channel_id'], |
|
| 1522 | ['id'], |
|
| 1523 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1524 | ); |
|
| 1525 | $table->addForeignKeyConstraint( |
|
| 1526 | $schema->getTable('orocrm_channel'), |
|
| 1527 | ['data_channel_id'], |
|
| 1528 | ['id'], |
|
| 1529 | ['onUpdate' => null, 'onDelete' => 'SET NULL'] |
|
| 1530 | ); |
|
| 1531 | } |
|
| 1532 | ||
| 1533 | /** |
|
| 1534 | * Enable activities |
|