Merge pull request #128 from lscortesc/hotfix/migrations
Fix Migrations | Installation Failed
This commit is contained in:
commit
5dd96b36ed
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue