Fix Migrations | Installation Failed

This commit is contained in:
Luis Cortés 2017-10-20 14:57:42 -05:00
parent 9d07b577c5
commit 53585b2451

View file

@ -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();
}
}