Skip to content

Commit

Permalink
Fix rollback for few migrations
Browse files Browse the repository at this point in the history
Few IrreversibleMigrationException exceptions throws:

- Column type "mediumtext" is not supported by MySQL
- Cannot reverse a "Phinx\Db\Action\ChangeColumn" command
- Cannot reverse a "Phinx\Db\Action\RemoveColumn" command
- Cannot reverse a "Phinx\Db\Action\DropIndex" command

Few MySQL errors:

- Cannot drop index '...': needed in a foreign key constraint
- Can't DROP 'type'; check that column/key exists

Older migrations were fixed just to prevent copy -> paste errors in
future.
  • Loading branch information
markoph committed Jun 13, 2023
1 parent 5d83b84 commit 45624d0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@

class NullableFamilySubscriptionTypesSlaveSubscriptionTypeId extends AbstractMigration
{
public function change()
public function up()
{
$this->table('family_subscription_types')
->changeColumn('slave_subscription_type_id', 'integer', ['null' => true])
->update();
}

public function down()
{
$this->table('family_subscription_types')
->changeColumn('slave_subscription_type_id', 'integer', ['null' => false])
->update();
}
}

0 comments on commit 45624d0

Please sign in to comment.