Skip to content

Commit

Permalink
Fix migrations on PostgreSQL. Issue #619 and #615
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasdelellis committed Dec 28, 2022
1 parent fa01c90 commit e5d1e07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Migration/Version000509Date20191203003814.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,19 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'notnull' => false,
'length' => 4,
]);
$table->addColumn('left', 'integer', [
$table->addColumn('x', 'integer', [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('right', 'integer', [
$table->addColumn('y', 'integer', [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('top', 'integer', [
$table->addColumn('width', 'integer', [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('bottom', 'integer', [
$table->addColumn('height', 'integer', [
'notnull' => true,
'length' => 4,
]);
Expand Down
8 changes: 8 additions & 0 deletions lib/Migration/Version0910Date20221109095949.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,28 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
if ($table->hasColumn('width'))
return null;

/**
* NOTE: These columns should just be notnull.
* In this migration add an default, since the previous rows would be null and cannot be migrated.
*/
$table->addColumn('x', 'integer', [
'notnull' => true,
'default' => -1,
'length' => 4,
]);
$table->addColumn('y', 'integer', [
'notnull' => true,
'default' => -1,
'length' => 4,
]);
$table->addColumn('width', 'integer', [
'notnull' => true,
'default' => -1,
'length' => 4,
]);
$table->addColumn('height', 'integer', [
'notnull' => true,
'default' => -1,
'length' => 4,
]);

Expand Down

0 comments on commit e5d1e07

Please sign in to comment.