]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - app/DoctrineMigrations/Version20190117131816.php
Enable PHPStan
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20190117131816.php
diff --git a/app/DoctrineMigrations/Version20190117131816.php b/app/DoctrineMigrations/Version20190117131816.php
new file mode 100644 (file)
index 0000000..6548b9f
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Wallabag\CoreBundle\Doctrine\WallabagMigration;
+
+/**
+ * Add updated_at fields to site_credential table.
+ */
+final class Version20190117131816 extends WallabagMigration
+{
+    public function up(Schema $schema): void
+    {
+        $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
+
+        $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
+
+        $siteCredentialTable->addColumn('updated_at', 'datetime', [
+            'notnull' => false,
+        ]);
+    }
+
+    public function down(Schema $schema): void
+    {
+        $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
+
+        $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
+
+        $siteCredentialTable->dropColumn('updated_at');
+    }
+}