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