diff options
Diffstat (limited to 'app/DoctrineMigrations/Version20190401105353.php')
-rw-r--r-- | app/DoctrineMigrations/Version20190401105353.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php new file mode 100644 index 00000000..600fc162 --- /dev/null +++ b/app/DoctrineMigrations/Version20190401105353.php | |||
@@ -0,0 +1,36 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Add hashed_url in entry. | ||
10 | */ | ||
11 | class Version20190401105353 extends WallabagMigration | ||
12 | { | ||
13 | public function up(Schema $schema) | ||
14 | { | ||
15 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
16 | |||
17 | $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
18 | |||
19 | $entryTable->addColumn('hashed_url', 'text', [ | ||
20 | 'length' => 40, | ||
21 | 'notnull' => false, | ||
22 | ]); | ||
23 | |||
24 | $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); | ||
25 | } | ||
26 | |||
27 | public function down(Schema $schema) | ||
28 | { | ||
29 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
30 | |||
31 | $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
32 | |||
33 | $entryTable->dropIndex('hashed_url_user_id'); | ||
34 | $entryTable->dropColumn('hashed_url'); | ||
35 | } | ||
36 | } | ||