3 namespace Application\Migrations
;
5 use Doctrine\DBAL\Schema\Schema
;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration
;
9 * Add hashed_url in entry.
11 class Version20190401105353
extends WallabagMigration
14 * @param Schema $schema
16 public function up(Schema
$schema)
18 $entryTable = $schema->getTable($this->getTable('entry'));
20 $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
22 $entryTable->addColumn('hashed_url', 'text', [
27 // sqlite doesn't have the MD5 function by default
28 if ('sqlite' !== $this->connection
->getDatabasePlatform()->getName()) {
29 $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)');
34 * @param Schema $schema
36 public function down(Schema
$schema)
38 $entryTable = $schema->getTable($this->getTable('entry'));
40 $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
42 $entryTable->dropColumn('hashed_url');