diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-26 15:40:42 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-28 14:28:35 +0100 |
commit | 84c6a48df412af7a15a63de5484c4bbcf27de33e (patch) | |
tree | 2e428e005fc92b8fde621c1ae224ab1222bae00b /app/DoctrineMigrations/Version20161024212538.php | |
parent | a4d55a9161144f7e0daafff8da13dabc9e090ae2 (diff) | |
download | wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.gz wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.tar.zst wallabag-84c6a48df412af7a15a63de5484c4bbcf27de33e.zip |
Added dropColumn for SQLite and some enhancements
Diffstat (limited to 'app/DoctrineMigrations/Version20161024212538.php')
-rw-r--r-- | app/DoctrineMigrations/Version20161024212538.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php index ced3a802..7e79cbde 100644 --- a/app/DoctrineMigrations/Version20161024212538.php +++ b/app/DoctrineMigrations/Version20161024212538.php | |||
@@ -29,12 +29,18 @@ class Version20161024212538 extends AbstractMigration implements ContainerAwareI | |||
29 | */ | 29 | */ |
30 | public function up(Schema $schema) | 30 | public function up(Schema $schema) |
31 | { | 31 | { |
32 | $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); | 32 | $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); |
33 | 33 | ||
34 | $this->skipIf($schema->getTable($this->getTable('oauth2_clients'))->hasColumn('user_id'), 'It seems that you already played this migration.'); | 34 | $this->skipIf($clientsTable->hasColumn('user_id'), 'It seems that you already played this migration.'); |
35 | 35 | ||
36 | $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD user_id INT(11) DEFAULT NULL'); | 36 | $clientsTable->addColumn('user_id', 'integer'); |
37 | $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD CONSTRAINT FK_clients_user_clients FOREIGN KEY (user_id) REFERENCES '.$this->getTable('user').' (id) ON DELETE CASCADE'); | 37 | |
38 | $clientsTable->addForeignKeyConstraint( | ||
39 | $this->getTable('user'), | ||
40 | array('user_id'), | ||
41 | array('id'), | ||
42 | array('onDelete' => 'CASCADE') | ||
43 | ); | ||
38 | } | 44 | } |
39 | 45 | ||
40 | /** | 46 | /** |