Merge pull request #128 from lscortesc/hotfix/migrations

Fix Migrations | Installation Failed
This commit is contained in:
Dmitry Khomutov 2017-10-21 09:23:42 +07:00 committed by GitHub
commit 5dd96b36ed

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