diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-11-23 09:53:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-23 09:53:18 +0100 |
commit | f4a98334903f01e6109b09e27dc1ebefab8f8865 (patch) | |
tree | 91bc4aaa5bbebb141911477113d28ab00973603f /app/DoctrineMigrations/Version20161122203647.php | |
parent | 75a4b3b23fcc183d926eb7cc782762085661b2da (diff) | |
parent | fcbf253b6bc0772adaf0d0e7cc51de50046cf64e (diff) | |
download | wallabag-f4a98334903f01e6109b09e27dc1ebefab8f8865.tar.gz wallabag-f4a98334903f01e6109b09e27dc1ebefab8f8865.tar.zst wallabag-f4a98334903f01e6109b09e27dc1ebefab8f8865.zip |
Merge pull request #2620 from wallabag/fix-password-layout
Fix password layout
Diffstat (limited to 'app/DoctrineMigrations/Version20161122203647.php')
-rw-r--r-- | app/DoctrineMigrations/Version20161122203647.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php new file mode 100644 index 00000000..ea2703b6 --- /dev/null +++ b/app/DoctrineMigrations/Version20161122203647.php | |||
@@ -0,0 +1,57 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Methods and properties removed from `FOS\UserBundle\Model\User` | ||
12 | * | ||
13 | * - `$expired` | ||
14 | * - `$credentialsExpired` | ||
15 | * - `setExpired()` (use `setExpiresAt(\DateTime::now()` instead) | ||
16 | * - `setCredentialsExpired()` (use `setCredentialsExpireAt(\DateTime::now()` instead) | ||
17 | * | ||
18 | * You need to drop the fields `expired` and `credentials_expired` from your database | ||
19 | * schema, because they aren't mapped anymore. | ||
20 | */ | ||
21 | class Version20161122203647 extends AbstractMigration implements ContainerAwareInterface | ||
22 | { | ||
23 | /** | ||
24 | * @var ContainerInterface | ||
25 | */ | ||
26 | private $container; | ||
27 | |||
28 | public function setContainer(ContainerInterface $container = null) | ||
29 | { | ||
30 | $this->container = $container; | ||
31 | } | ||
32 | |||
33 | private function getTable($tableName) | ||
34 | { | ||
35 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * @param Schema $schema | ||
40 | */ | ||
41 | public function up(Schema $schema) | ||
42 | { | ||
43 | $this->abortIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); | ||
44 | |||
45 | $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP expired'); | ||
46 | $this->addSql('ALTER TABLE '.$this->getTable('user').' DROP credentials_expired'); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * @param Schema $schema | ||
51 | */ | ||
52 | public function down(Schema $schema) | ||
53 | { | ||
54 | $this->addSql('ALTER TABLE '.$this->getTable('user').' ADD expired tinyint(1) NULL DEFAULT 0'); | ||
55 | $this->addSql('ALTER TABLE '.$this->getTable('user').' ADD credentials_expired tinyint(1) NULL DEFAULT 0'); | ||
56 | } | ||
57 | } | ||