aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20160906180558.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-09-06 20:21:49 +0200
committerThomas Citharel <tcit@tcit.fr>2017-06-23 09:18:39 +0200
commitf1900b686eb8d7c41a940eede778234ac55086e1 (patch)
tree3282794540fceaecc831fc9c736cecc57dbc1728 /app/DoctrineMigrations/Version20160906180558.php
parent29714661b1df78871ceaf0e079f11041a8641d4b (diff)
downloadwallabag-f1900b686eb8d7c41a940eede778234ac55086e1.tar.gz
wallabag-f1900b686eb8d7c41a940eede778234ac55086e1.tar.zst
wallabag-f1900b686eb8d7c41a940eede778234ac55086e1.zip
Added migration for user group
Just a first draft of #805
Diffstat (limited to 'app/DoctrineMigrations/Version20160906180558.php')
-rw-r--r--app/DoctrineMigrations/Version20160906180558.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20160906180558.php b/app/DoctrineMigrations/Version20160906180558.php
new file mode 100644
index 00000000..227bb20f
--- /dev/null
+++ b/app/DoctrineMigrations/Version20160906180558.php
@@ -0,0 +1,35 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7
8/**
9 * Auto-generated Migration: Please modify to your needs!
10 */
11class Version20160906180558 extends AbstractMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $this->addSql('CREATE TABLE `wallabag_group` (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL, UNIQUE INDEX UNIQ_B2305B375E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
19 $this->addSql('CREATE TABLE wallabag_user_group (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_6E85169A76ED395 (user_id), INDEX IDX_6E85169FE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
20 $this->addSql('ALTER TABLE wallabag_user_group ADD CONSTRAINT FK_6E85169A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id)');
21 $this->addSql('ALTER TABLE wallabag_user_group ADD CONSTRAINT FK_6E85169FE54D947 FOREIGN KEY (group_id) REFERENCES `wallabag_group` (id)');
22 }
23
24 /**
25 * @param Schema $schema
26 */
27 public function down(Schema $schema)
28 {
29 $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\'.');
30
31 $this->addSql('ALTER TABLE wallabag_user_group DROP FOREIGN KEY FK_6E85169FE54D947');
32 $this->addSql('DROP TABLE `wallabag_group`');
33 $this->addSql('DROP TABLE wallabag_user_group');
34 }
35}