]> git.immae.eu Git - github/wallabag/wallabag.git/blob - app/DoctrineMigrations/Version20181202073750.php
b6ad8bd73edad633b7776834f18cff27e12fe02e
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20181202073750.php
1 <?php
2
3 namespace Application\Migrations;
4
5 use Doctrine\DBAL\Schema\Schema;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8 /**
9 * Add 2fa OTP (named google authenticator).
10 */
11 final class Version20181202073750 extends WallabagMigration
12 {
13 public function up(Schema $schema): void
14 {
15 $tableName = $this->getTable('annotation');
16
17 switch ($this->connection->getDatabasePlatform()->getName()) {
18 case 'sqlite':
19 break;
20 case 'mysql':
21 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted, ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\'');
22 break;
23 case 'postgresql':
24 break;
25 }
26 }
27
28 public function down(Schema $schema): void
29 {
30 switch ($this->connection->getDatabasePlatform()->getName()) {
31 case 'sqlite':
32 break;
33 case 'mysql':
34 $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL, DROP backupCodes');
35 break;
36 case 'postgresql':
37 break;
38 }
39 }
40 }