forked from wallabag/wallabag
Added dropColumn for SQLite and some enhancements
This commit is contained in:
@ -29,9 +29,13 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->skipIf($schema->getTable($this->getTable('config'))->hasColumn('action_mark_as_read'), 'It seems that you already played this migration.');
|
||||
$configTable = $schema->getTable($this->getTable('config'));
|
||||
|
||||
$this->addSql('ALTER TABLE '.$this->getTable('config').' ADD action_mark_as_read INT DEFAULT 0');
|
||||
$this->skipIf($configTable->hasColumn('action_mark_as_read'), 'It seems that you already played this migration.');
|
||||
|
||||
$configTable->addColumn('action_mark_as_read', 'integer', [
|
||||
'default' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,8 +43,7 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI
|
||||
*/
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
|
||||
|
||||
$this->addSql('ALTER TABLE '.$this->getTable('config').' DROP action_mark_as_read');
|
||||
$configTable = $schema->getTable($this->getTable('config'));
|
||||
$userTable->dropColumn('action_mark_as_read');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user