Execute noop migrations

This commit is contained in:
Yassine Guedidi 2024-03-10 22:40:40 +01:00
parent 278e8cb0bb
commit 750dd643d1
3 changed files with 30 additions and 6 deletions

View File

@ -17,7 +17,11 @@ class Version20161024212538 extends WallabagMigration
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
$this->skipIf($clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.');
if ($clientsTable->hasColumn('user_id')) {
$this->write('It seems that you already played this migration.');
return;
}
$clientsTable->addColumn('user_id', 'integer', ['notnull' => false]);
@ -34,7 +38,11 @@ class Version20161024212538 extends WallabagMigration
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
$this->skipIf(!$clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.');
if ($clientsTable->hasColumn('user_id')) {
$this->write('It seems that you already played this migration.');
return;
}
$clientsTable->dropColumn('user_id', 'integer');

View File

@ -17,7 +17,11 @@ class Version20161214094402 extends WallabagMigration
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('uid'), 'It seems that you already played this migration.');
if ($entryTable->hasColumn('uid')) {
$this->write('It seems that you already played this migration.');
return;
}
$platform = $this->connection->getDatabasePlatform();
@ -41,7 +45,11 @@ class Version20161214094402 extends WallabagMigration
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('uuid'), 'It seems that you already played this migration.');
if ($entryTable->hasColumn('uuid')) {
$this->write('It seems that you already played this migration.');
return;
}
$platform = $this->connection->getDatabasePlatform();

View File

@ -13,14 +13,22 @@ class Version20170606155640 extends WallabagMigration
{
public function up(Schema $schema): void
{
$this->skipIf(!$schema->hasTable($this->getTable('craue_config_setting')), 'Table already renamed');
if (!$schema->hasTable($this->getTable('craue_config_setting'))) {
$this->write('Table already renamed');
return;
}
$apiUserRegistration = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
$this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.');
if (false === $apiUserRegistration) {
$this->write('It seems that you already played this migration.');
return;
}
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
}