3 namespace Application\Migrations
;
5 use Doctrine\DBAL\Schema\Schema
;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration
;
9 * Added `given_url` & `hashed_given_url` field in entry table.
11 class Version20190601125843
extends WallabagMigration
14 * @param Schema $schema
16 public function up(Schema
$schema)
18 $entryTable = $schema->getTable($this->getTable('entry'));
20 if (!$entryTable->hasColumn('given_url')) {
21 $entryTable->addColumn('given_url', 'text', [
26 if (!$entryTable->hasColumn('hashed_given_url')) {
27 $entryTable->addColumn('hashed_given_url', 'text', [
33 // 40 = length of sha1 field hashed_given_url
34 $entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]);
38 * @param Schema $schema
40 public function down(Schema
$schema)
42 $entryTable = $schema->getTable($this->getTable('entry'));
44 if ($entryTable->hasColumn('given_url')) {
45 $entryTable->dropColumn('given_url');
48 if ($entryTable->hasColumn('hashed_given_url')) {
49 $entryTable->dropColumn('hashed_given_url');
52 $entryTable->dropIndex('hashed_given_url_user_id');