|
@@ 883-888 (lines=6) @@
|
| 880 |
|
$instructions = $this->beginAlterByCopyTable($table->getName()); |
| 881 |
|
|
| 882 |
|
$tableName = $table->getName(); |
| 883 |
|
$instructions->addPostStep(function ($state) use ($column) { |
| 884 |
|
$sql = preg_replace("/(`$column`)\s+\w+\s+((NOT )?NULL)/", '$1 INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT', $state['createSQL'], 1); |
| 885 |
|
$this->execute($sql); |
| 886 |
|
|
| 887 |
|
return $state; |
| 888 |
|
}); |
| 889 |
|
|
| 890 |
|
$instructions->addPostStep(function ($state) { |
| 891 |
|
$columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($state['tmpTableName']))); |
|
@@ 915-924 (lines=10) @@
|
| 912 |
|
return $newState + $state; |
| 913 |
|
}); |
| 914 |
|
|
| 915 |
|
$instructions->addPostStep(function ($state) { |
| 916 |
|
$search = "/(,?\s*PRIMARY KEY\s*\([^\)]*\)|\s+PRIMARY KEY(\s+AUTOINCREMENT)?)/"; |
| 917 |
|
$sql = preg_replace($search, '', $state['createSQL'], 1); |
| 918 |
|
|
| 919 |
|
if ($sql) { |
| 920 |
|
$this->execute($sql); |
| 921 |
|
} |
| 922 |
|
|
| 923 |
|
return $state; |
| 924 |
|
}); |
| 925 |
|
|
| 926 |
|
$instructions = $this->copyAndDropTmpTable($instructions, $tableName); |
| 927 |
|
|