diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2019-04-25 13:28:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-25 13:28:09 +0200 |
commit | 522e37ad274361dde697da13a92ff3f846599822 (patch) | |
tree | a2b9302d885d886e013a6c33e800f5b39293e861 /app/DoctrineMigrations | |
parent | 3620dae1e6b3fab5a4ba4001b4581ce7ed795996 (diff) | |
parent | 76bc05ebc02408b213b536fec44e94b092889118 (diff) | |
download | wallabag-522e37ad274361dde697da13a92ff3f846599822.tar.gz wallabag-522e37ad274361dde697da13a92ff3f846599822.tar.zst wallabag-522e37ad274361dde697da13a92ff3f846599822.zip |
Merge pull request #3158 from wallabag/hash-exist-url
Hash exist url
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r-- | app/DoctrineMigrations/Version20190401105353.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php new file mode 100644 index 00000000..d27962db --- /dev/null +++ b/app/DoctrineMigrations/Version20190401105353.php | |||
@@ -0,0 +1,42 @@ | |||
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 | /** | ||
14 | * @param Schema $schema | ||
15 | */ | ||
16 | public function up(Schema $schema) | ||
17 | { | ||
18 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
19 | |||
20 | $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
21 | |||
22 | $entryTable->addColumn('hashed_url', 'text', [ | ||
23 | 'length' => 40, | ||
24 | 'notnull' => false, | ||
25 | ]); | ||
26 | |||
27 | $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function down(Schema $schema) | ||
34 | { | ||
35 | $entryTable = $schema->getTable($this->getTable('entry')); | ||
36 | |||
37 | $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); | ||
38 | |||
39 | $entryTable->dropIndex('hashed_url_user_id'); | ||
40 | $entryTable->dropColumn('hashed_url'); | ||
41 | } | ||
42 | } | ||