From 53585b2451a12ee72085ffa8ea0b4670000e57a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Cort=C3=A9s?= Date: Fri, 20 Oct 2017 14:57:42 -0500 Subject: [PATCH] Fix Migrations | Installation Failed --- ...014173348_removed_project_id_from_build_meta.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PHPCensor/Migrations/20171014173348_removed_project_id_from_build_meta.php b/src/PHPCensor/Migrations/20171014173348_removed_project_id_from_build_meta.php index 873aba78..24f5794e 100644 --- a/src/PHPCensor/Migrations/20171014173348_removed_project_id_from_build_meta.php +++ b/src/PHPCensor/Migrations/20171014173348_removed_project_id_from_build_meta.php @@ -8,6 +8,10 @@ class RemovedProjectIdFromBuildMeta extends AbstractMigration { $table = $this->table('build_meta'); + if ($table->hasForeignKey('project_id')) { + $table->dropForeignKey('project_id'); + } + if ($table->hasColumn('project_id')) { $table ->removeColumn('project_id') @@ -21,7 +25,14 @@ class RemovedProjectIdFromBuildMeta extends AbstractMigration if (!$table->hasColumn('project_id')) { $table - ->addColumn('project_id', 'integer', ['default' => 0]) + ->addColumn( + 'project_id', + 'integer', [ + 'default' => 0, + 'after' => 'id' + ] + ) + ->addForeignKey('project_id', 'project', 'id', ['delete'=> 'CASCADE', 'update' => 'CASCADE']) ->save(); } }