| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Doctrine\DBAL\Platforms; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Doctrine\DBAL\Schema\ForeignKeyConstraint; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Doctrine\DBAL\Schema\Identifier; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Doctrine\DBAL\Schema\Index; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Doctrine\DBAL\Schema\Table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Doctrine\DBAL\Schema\TableDiff; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Doctrine\DBAL\TransactionIsolationLevel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Doctrine\DBAL\Types\BlobType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Doctrine\DBAL\Types\TextType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use function array_diff_key; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use function array_merge; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use function array_unique; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use function array_values; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use function count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use function func_get_args; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use function implode; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use function in_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use function is_numeric; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use function is_string; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use function sprintf; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use function str_replace; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use function strtoupper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use function trim; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * The MySqlPlatform provides the behavior, features and SQL dialect of the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * MySQL database platform. This platform represents a MySQL 5.0 or greater platform that | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * uses the InnoDB storage engine. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  * @todo   Rename: MySQLPlatform | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | class MySqlPlatform extends AbstractPlatform | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public const LENGTH_LIMIT_TINYTEXT   = 255; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public const LENGTH_LIMIT_TEXT       = 65535; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     public const LENGTH_LIMIT_MEDIUMTEXT = 16777215; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     public const LENGTH_LIMIT_TINYBLOB   = 255; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     public const LENGTH_LIMIT_BLOB       = 65535; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public const LENGTH_LIMIT_MEDIUMBLOB = 16777215; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 10273 |  |     protected function doModifyLimitQuery($query, $limit, $offset) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 10273 |  |         if ($limit !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 10162 |  |             $query .= ' LIMIT ' . $limit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 10162 |  |             if ($offset > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 10162 |  |                 $query .= ' OFFSET ' . $offset; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 10261 |  |         } elseif ($offset > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             // 2^64-1 is the maximum of unsigned BIGINT, the biggest limit possible | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 10255 |  |             $query .= ' LIMIT 18446744073709551615 OFFSET ' . $offset; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 10273 |  |         return $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 10713 |  |     public function getIdentifierQuoteCharacter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 10713 |  |         return '`'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 75 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 76 | 7681 |  |     public function getRegexpExpression() | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 78 | 7681 |  |         return 'RLIKE'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @deprecated Use application-generated UUIDs instead | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 4822 |  |     public function getGuidExpression() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 4822 |  |         return 'UUID()'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 7144 |  |     public function getLocateExpression($str, $substr, $startPos = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 7144 |  |         if ($startPos === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 | 7144 |  |             return 'LOCATE(' . $substr . ', ' . $str . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 | 7144 |  |         return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 7681 |  |     public function getConcatExpression() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 7681 |  |         return sprintf('CONCAT(%s)', implode(', ', func_get_args())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 7158 |  |     protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 7158 |  |         $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 7158 |  |         return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 6640 |  |     public function getDateDiffExpression($date1, $date2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 | 6640 |  |         return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 9183 |  |     public function getListDatabasesSQL() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 9183 |  |         return 'SHOW DATABASES'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |     public function getListTableConstraintsSQL($table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |         return 'SHOW INDEX FROM ' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      * Two approaches to listing the table indexes. The information_schema is | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * preferred, because it doesn't cause problems with SQL keywords such as "order" or "table". | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 | 9679 |  |     public function getListTableIndexesSQL($table, $currentDatabase = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 9679 |  |         if ($currentDatabase) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 9679 |  |             $currentDatabase = $this->quoteStringLiteral($currentDatabase); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 | 9679 |  |             $table           = $this->quoteStringLiteral($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |             return 'SELECT NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, COLUMN_NAME AS Column_Name,' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |                    ' SUB_PART AS Sub_Part, INDEX_TYPE AS Index_Type' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 | 9679 |  |                    ' FROM information_schema.STATISTICS WHERE TABLE_NAME = ' . $table . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 9679 |  |                    ' AND TABLE_SCHEMA = ' . $currentDatabase . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 | 9679 |  |                    ' ORDER BY SEQ_IN_INDEX ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         return 'SHOW INDEX FROM ' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 | 8690 |  |     public function getListViewsSQL($database) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 | 8690 |  |         $database = $this->quoteStringLiteral($database); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 8690 |  |         return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $database; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 | 9663 |  |     public function getListTableForeignKeysSQL($table, $database = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 | 9663 |  |         $table = $this->quoteStringLiteral($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 | 9663 |  |         if ($database !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 9646 |  |             $database = $this->quoteStringLiteral($database); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         $sql = 'SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |                'k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |                'FROM information_schema.key_column_usage k /*!50116 ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |                'INNER JOIN information_schema.referential_constraints c ON ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |                '  c.constraint_name = k.constraint_name AND ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 | 9663 |  |                '  c.table_name = ' . $table . ' */ WHERE k.table_name = ' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 | 9663 |  |         $databaseNameSql = $database ?? 'DATABASE()'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 | 9663 |  |         $sql .= ' AND k.table_schema = ' . $databaseNameSql . ' /*!50116 AND c.constraint_schema = ' . $databaseNameSql . ' */'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 | 9663 |  |         $sql .= ' AND k.`REFERENCED_COLUMN_NAME` is not NULL'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 9663 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 5626 |  |     public function getCreateViewSQL($name, $sql) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 | 5626 |  |         return 'CREATE VIEW ' . $name . ' AS ' . $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 | 5626 |  |     public function getDropViewSQL($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 | 5626 |  |         return 'DROP VIEW ' . $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 10615 |  |     protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 10615 |  |         return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 10615 |  |                 : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 8588 |  |     protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 | 8588 |  |         return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      * Gets the SQL snippet used to declare a CLOB column type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |      *     TINYTEXT   : 2 ^  8 - 1 = 255 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |      *     TEXT       : 2 ^ 16 - 1 = 65535 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |      *     MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |      *     LONGTEXT   : 2 ^ 32 - 1 = 4294967295 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 10584 |  |     public function getClobTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 | 10584 |  |         if (! empty($field['length']) && is_numeric($field['length'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 | 9208 |  |             $length = $field['length']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 9208 |  |             if ($length <= static::LENGTH_LIMIT_TINYTEXT) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 | 9206 |  |                 return 'TINYTEXT'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 | 9208 |  |             if ($length <= static::LENGTH_LIMIT_TEXT) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 | 9208 |  |                 return 'TEXT'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 | 9206 |  |             if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 | 9206 |  |                 return 'MEDIUMTEXT'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 10582 |  |         return 'LONGTEXT'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 | 10470 |  |     public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 | 10470 |  |         if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 | 7456 |  |             return 'TIMESTAMP'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 | 10470 |  |         return 'DATETIME'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 | 5882 |  |     public function getDateTypeDeclarationSQL(array $fieldDeclaration) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 | 5882 |  |         return 'DATE'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 | 5808 |  |     public function getTimeTypeDeclarationSQL(array $fieldDeclaration) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 | 5808 |  |         return 'TIME'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 | 9144 |  |     public function getBooleanTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 9144 |  |         return 'TINYINT(1)'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |      * Obtain DBMS specific SQL code portion needed to set the COLLATION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |      * of a field declaration to be used in statements like CREATE TABLE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |      * @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |      * @param string $collation name of the collation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      * @return string  DBMS specific SQL code portion needed to set the COLLATION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |      *                 of a field declaration. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |     public function getCollationFieldDeclaration($collation) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |         return $this->getColumnCollationDeclarationSQL($collation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |      * MySql prefers "autoincrement" identity columns since sequences can only | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |      * be emulated with a table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 | 7766 |  |     public function prefersIdentityColumns() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 | 7766 |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * MySql supports this through AUTO_INCREMENT columns. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 | 5618 |  |     public function supportsIdentityColumns() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 | 5618 |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 | 10888 |  |     public function supportsInlineColumnComments() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 | 10888 |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 | 8979 |  |     public function supportsColumnCollation() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 | 8979 |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 | 6745 |  |     public function getListTablesSQL() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 | 6745 |  |         return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 | 9635 |  |     public function getListTableColumnsSQL($table, $database = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 | 9635 |  |         $table = $this->quoteStringLiteral($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 | 9635 |  |         if ($database) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 | 9618 |  |             $database = $this->quoteStringLiteral($database); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 | 6881 |  |             $database = 'DATABASE()'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |                'COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |                'CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 | 9635 |  |                'FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ' . $database . ' AND TABLE_NAME = ' . $table . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 | 9635 |  |                ' ORDER BY ORDINAL_POSITION ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 | 6598 |  |     public function getListTableMetadataSQL(string $table, ?string $database = null) : string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 | 6598 |  |         return sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |             <<<'SQL' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  | SELECT ENGINE, AUTO_INCREMENT, TABLE_COLLATION, TABLE_COMMENT, CREATE_OPTIONS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | FROM information_schema.TABLES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  | WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = %s AND TABLE_NAME = %s | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  | SQL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 | 6598 |  |             $database ? $this->quoteStringLiteral($database) : 'DATABASE()', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 | 6598 |  |             $this->quoteStringLiteral($table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 | 10673 |  |     public function getCreateDatabaseSQL($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 | 10673 |  |         return 'CREATE DATABASE ' . $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 | 10673 |  |     public function getDropDatabaseSQL($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 | 10673 |  |         return 'DROP DATABASE ' . $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 | 10780 |  |     protected function _getCreateTableSQL($tableName, array $columns, array $options = []) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 | 10780 |  |         $queryFields = $this->getColumnDeclarationListSQL($columns); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 | 10780 |  |         if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |             foreach ($options['uniqueConstraints'] as $index => $definition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |                 $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |         // add all indexes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 | 10780 |  |         if (isset($options['indexes']) && ! empty($options['indexes'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 | 10398 |  |             foreach ($options['indexes'] as $index => $definition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 | 10398 |  |                 $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |         // attach all primary keys | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 | 10780 |  |         if (isset($options['primary']) && ! empty($options['primary'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 | 10430 |  |             $keyColumns   = array_unique(array_values($options['primary'])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 | 10430 |  |             $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 | 10780 |  |         $query = 'CREATE '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 | 10780 |  |         if (! empty($options['temporary'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             $query .= 'TEMPORARY '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 | 10780 |  |         $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 | 10780 |  |         $query .= $this->buildTableOptions($options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 | 10780 |  |         $query .= $this->buildPartitionOptions($options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 | 10780 |  |         $sql    = [$query]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 | 10780 |  |         $engine = 'INNODB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 | 10780 |  |         if (isset($options['engine'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 | 9376 |  |             $engine = strtoupper(trim($options['engine'])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |         // Propagate foreign key constraints only for InnoDB. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 | 10780 |  |         if (isset($options['foreignKeys']) && $engine === 'INNODB') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 | 10412 |  |             foreach ((array) $options['foreignKeys'] as $definition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 | 10216 |  |                 $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 | 10780 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 | 10894 |  |     public function getDefaultValueDeclarationSQL($field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |         // Unset the default value if the given field definition does not allow default values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 | 10894 |  |         if ($field['type'] instanceof TextType || $field['type'] instanceof BlobType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 | 10570 |  |             $field['default'] = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 | 10894 |  |         return parent::getDefaultValueDeclarationSQL($field); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      * Build SQL for table options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |      * @param mixed[] $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 | 10780 |  |     private function buildTableOptions(array $options) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 | 10780 |  |         if (isset($options['table_options'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |             return $options['table_options']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 | 10780 |  |         $tableOptions = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |         // Charset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 | 10780 |  |         if (! isset($options['charset'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 | 10780 |  |             $options['charset'] = 'utf8'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 | 10780 |  |         $tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |         // Collate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 | 10780 |  |         if (! isset($options['collate'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 | 10780 |  |             $options['collate'] = $options['charset'] . '_unicode_ci'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 | 10780 |  |         $tableOptions[] = $this->getColumnCollationDeclarationSQL($options['collate']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |         // Engine | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 | 10780 |  |         if (! isset($options['engine'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 | 10762 |  |             $options['engine'] = 'InnoDB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 | 10780 |  |         $tableOptions[] = sprintf('ENGINE = %s', $options['engine']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         // Auto increment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 | 10780 |  |         if (isset($options['auto_increment'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |             $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         // Comment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 | 10780 |  |         if (isset($options['comment'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 | 5165 |  |             $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($options['comment'])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |         // Row format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 | 10780 |  |         if (isset($options['row_format'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |             $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 | 10780 |  |         return implode(' ', $tableOptions); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |      * Build SQL for partition options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |      * @param mixed[] $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 | 10780 |  |     private function buildPartitionOptions(array $options) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 | 10780 |  |         return isset($options['partition_options']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |             ? ' ' . $options['partition_options'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 | 10780 |  |             : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 | 10067 |  |     public function getAlterTableSQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 | 10067 |  |         $columnSql  = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 | 10067 |  |         $queryParts = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 | 10067 |  |         $newName    = $diff->getNewName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 | 10067 |  |         if ($newName !== false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 | 6362 |  |             $queryParts[] = 'RENAME TO ' . $newName->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 | 10067 |  |         foreach ($diff->addedColumns as $column) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 | 9802 |  |             if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 | 9802 |  |             $columnArray            = $column->toArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 | 9802 |  |             $columnArray['comment'] = $this->getColumnComment($column); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 | 9802 |  |             $queryParts[]           = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 | 10067 |  |         foreach ($diff->removedColumns as $column) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 | 8452 |  |             if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 | 8452 |  |             $queryParts[] =  'DROP ' . $column->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 | 10067 |  |         foreach ($diff->changedColumns as $columnDiff) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 | 8868 |  |             if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 | 8868 |  |             $column      = $columnDiff->column; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 | 8868 |  |             $columnArray = $column->toArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             // Don't propagate default value changes for unsupported column types. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 | 8868 |  |             if ($columnDiff->hasChanged('default') && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 | 8868 |  |                 count($columnDiff->changedProperties) === 1 && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 | 8868 |  |                 ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |             ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 | 7032 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 | 8844 |  |             $columnArray['comment'] = $this->getColumnComment($column); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 | 8844 |  |             $queryParts[]           =  'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 | 8844 |  |                     . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 | 10067 |  |         foreach ($diff->renamedColumns as $oldColumnName => $column) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 | 8380 |  |             if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 | 8380 |  |             $oldColumnName          = new Identifier($oldColumnName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 | 8380 |  |             $columnArray            = $column->toArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 | 8380 |  |             $columnArray['comment'] = $this->getColumnComment($column); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 | 8380 |  |             $queryParts[]           =  'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 | 8380 |  |                     . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 | 10067 |  |         if (isset($diff->addedIndexes['primary'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 | 9461 |  |             $keyColumns   = array_unique(array_values($diff->addedIndexes['primary']->getColumns())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 | 9461 |  |             $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 | 9461 |  |             unset($diff->addedIndexes['primary']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 | 10003 |  |         } elseif (isset($diff->changedIndexes['primary'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |             // Necessary in case the new primary key includes a new auto_increment column | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 | 9836 |  |             foreach ($diff->changedIndexes['primary']->getColumns() as $columnName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 | 9836 |  |                 if (isset($diff->addedColumns[$columnName]) && $diff->addedColumns[$columnName]->getAutoincrement()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 | 6598 |  |                     $keyColumns   = array_unique(array_values($diff->changedIndexes['primary']->getColumns())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 | 6598 |  |                     $queryParts[] = 'DROP PRIMARY KEY'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 | 6598 |  |                     $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 | 6598 |  |                     unset($diff->changedIndexes['primary']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 | 6624 |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 | 10067 |  |         $sql      = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 | 10067 |  |         $tableSql = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 | 10067 |  |         if (! $this->onSchemaAlterTable($diff, $tableSql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 | 10067 |  |             if (count($queryParts) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 | 9989 |  |                 $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(', ', $queryParts); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 | 10067 |  |             $sql = array_merge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 | 10067 |  |                 $this->getPreAlterTableIndexForeignKeySQL($diff), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 | 10067 |  |                 $sql, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 | 10067 |  |                 $this->getPostAlterTableIndexForeignKeySQL($diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 | 10067 |  |         return array_merge($sql, $tableSql, $columnSql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 | 10067 |  |     protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 | 10067 |  |         $sql   = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 | 10067 |  |         $table = $diff->getName($this)->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 | 10067 |  |         foreach ($diff->changedIndexes as $changedIndex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 | 8884 |  |             $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $changedIndex)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 | 10067 |  |         foreach ($diff->removedIndexes as $remKey => $remIndex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 | 9345 |  |             $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $remIndex)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 | 9345 |  |             foreach ($diff->addedIndexes as $addKey => $addIndex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 | 7431 |  |                 if ($remIndex->getColumns() === $addIndex->getColumns()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 | 7431 |  |                     $indexClause = 'INDEX ' . $addIndex->getName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 | 7431 |  |                     if ($addIndex->isPrimary()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |                         $indexClause = 'PRIMARY KEY'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 | 7431 |  |                     } elseif ($addIndex->isUnique()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 | 7431 |  |                         $indexClause = 'UNIQUE INDEX ' . $addIndex->getName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 | 7431 |  |                     $query  = 'ALTER TABLE ' . $table . ' DROP INDEX ' . $remIndex->getName() . ', '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 | 7431 |  |                     $query .= 'ADD ' . $indexClause; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 | 7431 |  |                     $query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex) . ')'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 | 7431 |  |                     $sql[] = $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 | 7431 |  |                     unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 | 7443 |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 | 10067 |  |         $engine = 'INNODB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 | 10067 |  |         if ($diff->fromTable instanceof Table && $diff->fromTable->hasOption('engine')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 | 9227 |  |             $engine = strtoupper(trim($diff->fromTable->getOption('engine'))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |         // Suppress foreign key constraint propagation on non-supporting engines. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 | 10067 |  |         if ($engine !== 'INNODB') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 | 7031 |  |             $diff->addedForeignKeys   = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 | 7031 |  |             $diff->changedForeignKeys = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 | 7031 |  |             $diff->removedForeignKeys = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 | 10067 |  |         $sql = array_merge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 | 10067 |  |             $sql, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 | 10067 |  |             $this->getPreAlterTableAlterIndexForeignKeySQL($diff), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 | 10067 |  |             parent::getPreAlterTableIndexForeignKeySQL($diff), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 | 10067 |  |             $this->getPreAlterTableRenameIndexForeignKeySQL($diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 | 10067 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |      * @return string[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 | 9377 |  |     private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 | 9377 |  |         $sql = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 | 9377 |  |         if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 | 9345 |  |             return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 | 9290 |  |         $tableName = $diff->getName($this)->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |         // Dropping primary keys requires to unset autoincrement attribute on the particular column first. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 | 9290 |  |         foreach ($index->getColumns() as $columnName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 | 9290 |  |             if (! $diff->fromTable->hasColumn($columnName)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 | 7156 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 | 9290 |  |             $column = $diff->fromTable->getColumn($columnName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 | 9290 |  |             if ($column->getAutoincrement() !== true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 | 9284 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 | 9265 |  |             $column->setAutoincrement(false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 | 9265 |  |             $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 | 9265 |  |                 $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |             // original autoincrement information might be needed later on by other parts of the table alteration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 | 9265 |  |             $column->setAutoincrement(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 | 9290 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |      * @param TableDiff $diff The table diff to gather the SQL for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |      * @return string[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 | 10067 |  |     private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 | 10067 |  |         $sql   = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 | 10067 |  |         $table = $diff->getName($this)->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 | 10067 |  |         foreach ($diff->changedIndexes as $changedIndex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |             // Changed primary key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 | 8884 |  |             if (! $changedIndex->isPrimary() || ! ($diff->fromTable instanceof Table)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 | 8803 |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 | 7326 |  |             foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 | 7326 |  |                 $column = $diff->fromTable->getColumn($columnName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |                 // Check if an autoincrement column was dropped from the primary key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 | 7326 |  |                 if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns())) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 | 7270 |  |                     continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |                 // The autoincrement attribute needs to be removed from the dropped column | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |                 // before we can drop and recreate the primary key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 | 7306 |  |                 $column->setAutoincrement(false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 | 7306 |  |                 $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 | 7306 |  |                     $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |                 // Restore the autoincrement attribute as it might be needed later on | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |                 // by other parts of the table alteration. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 | 7326 |  |                 $column->setAutoincrement(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 | 10067 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |      * @param TableDiff $diff The table diff to gather the SQL for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  |      * @return string[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 | 9324 |  |     protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 | 9324 |  |         $sql       = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 | 9324 |  |         $tableName = $diff->getName($this)->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 | 9324 |  |         foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 | 7290 |  |             if (in_array($foreignKey, $diff->changedForeignKeys, true)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 | 7290 |  |             $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 | 9324 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |      * Returns the remaining foreign key constraints that require one of the renamed indexes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |      * "Remaining" here refers to the diff between the foreign keys currently defined in the associated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |      * table and the foreign keys to be removed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |      * @param TableDiff $diff The table diff to evaluate. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |      * @return ForeignKeyConstraint[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 | 9324 |  |     private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 | 9324 |  |         if (empty($diff->renamedIndexes) || ! $diff->fromTable instanceof Table) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 | 9304 |  |             return []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 | 7581 |  |         $foreignKeys = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |         /** @var ForeignKeyConstraint[] $remainingForeignKeys */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 | 7581 |  |         $remainingForeignKeys = array_diff_key( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 | 7581 |  |             $diff->fromTable->getForeignKeys(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 | 7581 |  |             $diff->removedForeignKeys | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 | 7581 |  |         foreach ($remainingForeignKeys as $foreignKey) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 | 7290 |  |             foreach ($diff->renamedIndexes as $index) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 | 7290 |  |                 if ($foreignKey->intersectsIndexColumns($index)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 | 7290 |  |                     $foreignKeys[] = $foreignKey; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 | 7290 |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 | 7581 |  |         return $foreignKeys; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 | 10067 |  |     protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 | 10067 |  |         return array_merge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 | 10067 |  |             parent::getPostAlterTableIndexForeignKeySQL($diff), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 | 10067 |  |             $this->getPostAlterTableRenameIndexForeignKeySQL($diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |      * @param TableDiff $diff The table diff to gather the SQL for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |      * @return string[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 | 9324 |  |     protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 | 9324 |  |         $sql     = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 | 9324 |  |         $newName = $diff->getNewName(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 | 9324 |  |         if ($newName !== false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 | 6358 |  |             $tableName = $newName->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 | 9316 |  |             $tableName = $diff->getName($this)->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 | 9324 |  |         foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 | 7290 |  |             if (in_array($foreignKey, $diff->changedForeignKeys, true)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |                 continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 | 7290 |  |             $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 | 9324 |  |         return $sql; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 | 10503 |  |     protected function getCreateIndexSQLFlags(Index $index) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 | 10503 |  |         $type = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 | 10503 |  |         if ($index->isUnique()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 | 10333 |  |             $type .= 'UNIQUE '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 | 10430 |  |         } elseif ($index->hasFlag('fulltext')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 | 9364 |  |             $type .= 'FULLTEXT '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 | 10413 |  |         } elseif ($index->hasFlag('spatial')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 | 9339 |  |             $type .= 'SPATIAL '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 | 10503 |  |         return $type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 | 10800 |  |     public function getIntegerTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 | 10800 |  |         return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 | 4794 |  |     public function getBigIntTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 | 4794 |  |         return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 | 5514 |  |     public function getSmallIntTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 | 5514 |  |         return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 | 8325 |  |     public function getFloatDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 | 8325 |  |         return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($field); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 | 8394 |  |     public function getDecimalTypeDeclarationSQL(array $columnDef) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 | 8394 |  |         return parent::getDecimalTypeDeclarationSQL($columnDef) . $this->getUnsignedDeclaration($columnDef); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |      * Get unsigned declaration for a column. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |      * @param mixed[] $columnDef | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 | 10872 |  |     private function getUnsignedDeclaration(array $columnDef) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 | 10872 |  |         return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 | 10800 |  |     protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 | 10800 |  |         $autoinc = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 | 10800 |  |         if (! empty($columnDef['autoincrement'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 | 10212 |  |             $autoinc = ' AUTO_INCREMENT'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 | 10800 |  |         return $this->getUnsignedDeclaration($columnDef) . $autoinc; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 | 9020 |  |     public function getColumnCharsetDeclarationSQL($charset) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 | 9020 |  |         return 'CHARACTER SET ' . $charset; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 | 10246 |  |     public function getColumnCollationDeclarationSQL($collation) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 | 10246 |  |         return 'COLLATE ' . $this->quoteSingleIdentifier($collation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 | 10246 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 | 10246 |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 | 10246 |  |     public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  |         $query = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  |         if ($foreignKey->hasOption('match')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  |             $query .= ' MATCH ' . $foreignKey->getOption('match'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 | 9347 |  |         $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 | 9347 |  |         return $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 | 9327 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 | 8312 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 | 8312 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  |     public function getDropIndexSQL($index, $table = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 | 9347 |  |         if ($index instanceof Index) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 | 5696 |  |             $indexName = $index->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 | 9347 |  |         } elseif (is_string($index)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  |             $indexName = $index; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  |             throw new InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 | 9347 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  |         if ($table instanceof Table) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 | 9296 |  |             $table = $table->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |         } elseif (! is_string($table)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  |             throw new InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 | 9309 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  |         if ($index instanceof Index && $index->isPrimary()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  |             // mysql primary keys are always named "PRIMARY", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  |             // so we cannot use them in statements because of them being keyword. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  |             return $this->getDropPrimaryKeySQL($table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 | 9296 |  |         return 'DROP INDEX ' . $indexName . ' ON ' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 | 9296 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  |      * @param string $table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 | 7656 |  |     protected function getDropPrimaryKeySQL($table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 | 7656 |  |         return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 | 10174 |  |     public function getSetTransactionIsolationSQL($level) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 | 10174 |  |         return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  |     public function getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  |         return 'mysql'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 | 10042 |  |     public function getReadLockSQL() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 | 10042 |  |         return 'LOCK IN SHARE MODE'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  |     protected function initializeDoctrineTypeMappings() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  |         $this->doctrineTypeMapping = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  |             'tinyint'       => 'boolean', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  |             'smallint'      => 'smallint', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  |             'mediumint'     => 'integer', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  |             'int'           => 'integer', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  |             'integer'       => 'integer', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  |             'bigint'        => 'bigint', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  |             'tinytext'      => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |             'mediumtext'    => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  |             'longtext'      => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  |             'text'          => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  |             'varchar'       => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  |             'string'        => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  |             'char'          => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  |             'date'          => 'date', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  |             'datetime'      => 'datetime', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  |             'timestamp'     => 'datetime', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  |             'time'          => 'time', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  |             'float'         => 'float', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  |             'double'        => 'float', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  |             'real'          => 'float', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |             'decimal'       => 'decimal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  |             'numeric'       => 'decimal', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  |             'year'          => 'date', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 | 10042 |  |             'longblob'      => 'blob', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  |             'blob'          => 'blob', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  |             'mediumblob'    => 'blob', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  |             'tinyblob'      => 'blob', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  |             'binary'        => 'binary', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 | 10615 |  |             'varbinary'     => 'binary', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  |             'set'           => 'simple_array', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 | 10615 |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 | 8600 |  |     public function getVarcharMaxLength() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 | 8600 |  |         return 65535; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 | 5321 |  |     public function getBinaryMaxLength() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 | 5321 |  |         return 65535; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  |     protected function getReservedKeywordsClass() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  |         return Keywords\MySQLKeywords::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 | 4850 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 | 4850 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 | 4850 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  |      * MySQL commits a transaction implicitly when DROP TABLE is executed, however not | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  |      * if DROP TEMPORARY TABLE is executed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 | 4850 |  |     public function getDropTemporaryTableSQL($table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |         if ($table instanceof Table) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  |             $table = $table->getQuotedName($this); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  |         } elseif (! is_string($table)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  |             throw new InvalidArgumentException('getDropTemporaryTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  |         return 'DROP TEMPORARY TABLE ' . $table; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 | 10427 |  |      * Gets the SQL Snippet used to declare a BLOB column type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  |      *     TINYBLOB   : 2 ^  8 - 1 = 255 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 | 10427 |  |      *     BLOB       : 2 ^ 16 - 1 = 65535 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 | 9091 |  |      *     MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  |      *     LONGBLOB   : 2 ^ 32 - 1 = 4294967295 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 | 9091 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 | 5972 |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  |     public function getBlobTypeDeclarationSQL(array $field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 | 9091 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 | 5972 |  |         if (! empty($field['length']) && is_numeric($field['length'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  |             $length = $field['length']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 | 9091 |  |             if ($length <= static::LENGTH_LIMIT_TINYBLOB) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 | 9091 |  |                 return 'TINYBLOB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  |             if ($length <= static::LENGTH_LIMIT_BLOB) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 | 10427 |  |                 return 'BLOB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |             if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  |                 return 'MEDIUMBLOB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 | 9805 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 | 9805 |  |         return 'LONGBLOB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 | 9805 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  |     public function quoteStringLiteral($str) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 | 2777 |  |         $str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped aswell. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 | 2777 |  |         return parent::quoteStringLiteral($str); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 | 10773 |  |     public function getDefaultTransactionIsolationLevel() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 | 10773 |  |         return TransactionIsolationLevel::REPEATABLE_READ; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  |      * {@inheritdoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  |     public function supportsColumnLengthIndexes() : bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1187 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 1188 |  |  |  |