|
8 | 8 | $installer->startSetup();
|
9 | 9 | $connection = $installer->getConnection();
|
10 | 10 |
|
11 |
| -//Drop entity_type_id and attribute_set_id from column for customer_address_entity |
12 |
| -$connection->dropForeignKey( |
13 |
| - $installer->getTable('customer_address_entity_varchar'), |
14 |
| - $installer->getFkName('customer_address_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
15 |
| -); |
16 |
| -$connection->dropIndex( |
17 |
| - 'customer_address_entity_varchar', |
18 |
| - $installer->getIdxName( |
19 |
| - 'customer_address_entity_varchar', |
20 |
| - ['entity_type_id'], |
21 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
22 |
| - ) |
23 |
| -); |
24 |
| - |
25 |
| -$connection->dropForeignKey( |
26 |
| - $installer->getTable('customer_address_entity_datetime'), |
27 |
| - $installer->getFkName('customer_address_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
28 |
| -); |
29 |
| -$connection->dropIndex( |
30 |
| - 'customer_address_entity_datetime', |
31 |
| - $installer->getIdxName( |
32 |
| - 'customer_address_entity_datetime', |
33 |
| - ['entity_type_id'], |
34 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
35 |
| - ) |
36 |
| -); |
| 11 | +$tableNames = [ |
| 12 | + 'customer_address_entity_varchar', 'customer_address_entity_datetime', |
| 13 | + 'customer_address_entity_decimal', 'customer_address_entity_int', 'customer_address_entity_text', |
| 14 | + 'customer_entity_varchar', 'customer_entity_datetime', |
| 15 | + 'customer_entity_decimal', 'customer_entity_int', 'customer_entity_text' |
| 16 | +]; |
| 17 | + |
| 18 | +foreach ($tableNames as $table) { |
| 19 | + $connection->dropForeignKey( |
| 20 | + $installer->getTable($table), |
| 21 | + $installer->getFkName($table, 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
| 22 | + ); |
| 23 | + $connection->dropIndex( |
| 24 | + $installer->getTable($table), |
| 25 | + $installer->getIdxName( |
| 26 | + $installer->getTable($table), |
| 27 | + ['entity_type_id'], |
| 28 | + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
| 29 | + ) |
| 30 | + ); |
| 31 | + $connection->dropColumn($installer->getTable($table), 'entity_type_id'); |
| 32 | +} |
37 | 33 |
|
38 |
| -$connection->dropForeignKey( |
39 |
| - $installer->getTable('customer_address_entity_decimal'), |
40 |
| - $installer->getFkName('customer_address_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
41 |
| -); |
42 |
| -$connection->dropIndex( |
43 |
| - 'customer_address_entity_decimal', |
44 |
| - $installer->getIdxName( |
45 |
| - 'customer_address_entity_decimal', |
46 |
| - ['entity_type_id'], |
47 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
48 |
| - ) |
49 |
| -); |
50 |
| - |
51 |
| -$connection->dropForeignKey( |
52 |
| - $installer->getTable('customer_address_entity_int'), |
53 |
| - $installer->getFkName('customer_address_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
54 |
| -); |
55 |
| -$connection->dropIndex( |
56 |
| - 'customer_address_entity_int', |
57 |
| - $installer->getIdxName( |
58 |
| - 'customer_address_entity_int', |
59 |
| - ['entity_type_id'], |
60 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
61 |
| - ) |
62 |
| -); |
63 |
| - |
64 |
| -$connection->dropForeignKey( |
65 |
| - $installer->getTable('customer_address_entity_text'), |
66 |
| - $installer->getFkName('customer_address_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
67 |
| -); |
68 |
| -$connection->dropIndex( |
69 |
| - 'customer_address_entity_text', |
70 |
| - $installer->getIdxName( |
71 |
| - 'customer_address_entity_text', |
72 |
| - ['entity_type_id'], |
73 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
74 |
| - ) |
75 |
| -); |
76 | 34 | $connection->dropColumn($installer->getTable('customer_address_entity'), 'entity_type_id');
|
77 | 35 | $connection->dropColumn($installer->getTable('customer_address_entity'), 'attribute_set_id');
|
78 |
| -$connection->dropColumn($installer->getTable('customer_address_entity_datetime'), 'entity_type_id'); |
79 |
| -$connection->dropColumn($installer->getTable('customer_address_entity_decimal'), 'entity_type_id'); |
80 |
| -$connection->dropColumn($installer->getTable('customer_address_entity_int'), 'entity_type_id'); |
81 |
| -$connection->dropColumn($installer->getTable('customer_address_entity_text'), 'entity_type_id'); |
82 |
| -$connection->dropColumn($installer->getTable('customer_address_entity_varchar'), 'entity_type_id'); |
83 | 36 |
|
84 |
| -//Drop entity_type_id and attribute_set_id from column for customer_entity |
85 | 37 | $connection->dropIndex(
|
86 |
| - 'customer_entity', |
| 38 | + $installer->getTable('customer_entity'), |
87 | 39 | $installer->getIdxName('customer_entity', ['entity_type_id'])
|
88 | 40 | );
|
89 |
| - |
90 |
| -$connection->dropForeignKey( |
91 |
| - $installer->getTable('customer_entity_varchar'), |
92 |
| - $installer->getFkName('customer_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
93 |
| -); |
94 |
| -$connection->dropIndex( |
95 |
| - 'customer_entity_varchar', |
96 |
| - $installer->getIdxName( |
97 |
| - 'customer_entity_varchar', |
98 |
| - ['entity_type_id'], |
99 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
100 |
| - ) |
101 |
| -); |
102 |
| - |
103 |
| -$connection->dropForeignKey( |
104 |
| - $installer->getTable('customer_entity_datetime'), |
105 |
| - $installer->getFkName('customer_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
106 |
| -); |
107 |
| -$connection->dropIndex( |
108 |
| - 'customer_entity_datetime', |
109 |
| - $installer->getIdxName( |
110 |
| - 'customer_entity_datetime', |
111 |
| - ['entity_type_id'], |
112 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
113 |
| - ) |
114 |
| -); |
115 |
| - |
116 |
| -$connection->dropForeignKey( |
117 |
| - $installer->getTable('customer_entity_decimal'), |
118 |
| - $installer->getFkName('customer_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
119 |
| -); |
120 |
| -$connection->dropIndex( |
121 |
| - 'customer_entity_decimal', |
122 |
| - $installer->getIdxName( |
123 |
| - 'customer_entity_decimal', |
124 |
| - ['entity_type_id'], |
125 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
126 |
| - ) |
127 |
| -); |
128 |
| - |
129 |
| -$connection->dropForeignKey( |
130 |
| - $installer->getTable('customer_entity_int'), |
131 |
| - $installer->getFkName('customer_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
132 |
| -); |
133 |
| -$connection->dropIndex( |
134 |
| - 'customer_entity_int', |
135 |
| - $installer->getIdxName('customer_entity_int', ['entity_type_id']) |
136 |
| -); |
137 |
| - |
138 |
| -$connection->dropForeignKey( |
139 |
| - $installer->getTable('customer_entity_text'), |
140 |
| - $installer->getFkName('customer_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id') |
141 |
| -); |
142 |
| -$connection->dropIndex( |
143 |
| - 'customer_entity_text', |
144 |
| - $installer->getIdxName( |
145 |
| - 'customer_entity_text', |
146 |
| - ['entity_type_id'], |
147 |
| - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE |
148 |
| - ) |
149 |
| -); |
150 | 41 | $connection->dropColumn($installer->getTable('customer_entity'), 'entity_type_id');
|
151 | 42 | $connection->dropColumn($installer->getTable('customer_entity'), 'attribute_set_id');
|
152 |
| -$connection->dropColumn($installer->getTable('customer_entity_datetime'), 'entity_type_id'); |
153 |
| -$connection->dropColumn($installer->getTable('customer_entity_decimal'), 'entity_type_id'); |
154 |
| -$connection->dropColumn($installer->getTable('customer_entity_int'), 'entity_type_id'); |
155 |
| -$connection->dropColumn($installer->getTable('customer_entity_text'), 'entity_type_id'); |
156 |
| -$connection->dropColumn($installer->getTable('customer_entity_varchar'), 'entity_type_id'); |
157 | 43 | $installer->endSetup();
|
0 commit comments