diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-09-06 20:21:49 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-06-23 09:18:39 +0200 |
commit | f1900b686eb8d7c41a940eede778234ac55086e1 (patch) | |
tree | 3282794540fceaecc831fc9c736cecc57dbc1728 /app | |
parent | 29714661b1df78871ceaf0e079f11041a8641d4b (diff) | |
download | wallabag-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')
-rw-r--r-- | app/DoctrineMigrations/Version20160906180558.php | 35 | ||||
-rw-r--r-- | app/config/config.yml | 2 | ||||
-rw-r--r-- | app/config/routing.yml | 4 |
3 files changed, 41 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 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | |||
8 | /** | ||
9 | * Auto-generated Migration: Please modify to your needs! | ||
10 | */ | ||
11 | class 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 | } | ||
diff --git a/app/config/config.yml b/app/config/config.yml index 2bc5e3b3..f1d93aaa 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -178,6 +178,8 @@ fos_user: | |||
178 | db_driver: orm | 178 | db_driver: orm |
179 | firewall_name: secured_area | 179 | firewall_name: secured_area |
180 | user_class: Wallabag\UserBundle\Entity\User | 180 | user_class: Wallabag\UserBundle\Entity\User |
181 | group: | ||
182 | group_class: Wallabag\UserBundle\Entity\Group | ||
181 | registration: | 183 | registration: |
182 | confirmation: | 184 | confirmation: |
183 | enabled: "%fosuser_confirmation%" | 185 | enabled: "%fosuser_confirmation%" |
diff --git a/app/config/routing.yml b/app/config/routing.yml index 0bd2d130..9c916f7d 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml | |||
@@ -41,6 +41,10 @@ homepage: | |||
41 | fos_user: | 41 | fos_user: |
42 | resource: "@FOSUserBundle/Resources/config/routing/all.xml" | 42 | resource: "@FOSUserBundle/Resources/config/routing/all.xml" |
43 | 43 | ||
44 | fos_user_group: | ||
45 | resource: "@FOSUserBundle/Resources/config/routing/group.xml" | ||
46 | prefix: /group | ||
47 | |||
44 | fos_oauth_server_token: | 48 | fos_oauth_server_token: |
45 | resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" | 49 | resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" |
46 | 50 | ||