aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-10-29 13:20:55 +0200
committerGitHub <noreply@github.com>2016-10-29 13:20:55 +0200
commit5feef9f7a4e6852415feb388190b7ca141f116d1 (patch)
tree773b12c221b089ba508040e855d78f27edb589b0 /app/DoctrineMigrations
parent8e58be9fb62615cdd8f4b55ad0981f57641bf0ab (diff)
parentf08ec5f88a78bfe2edf2c2148094f3f099e8389c (diff)
downloadwallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.tar.gz
wallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.tar.zst
wallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.zip
Merge pull request #2499 from wallabag/add-relation-client-user
Added relation between API Client and User
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r--app/DoctrineMigrations/Version20161024212538.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php
new file mode 100644
index 00000000..f8e927e4
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161024212538.php
@@ -0,0 +1,45 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 private $container;
16
17 public function setContainer(ContainerInterface $container = null)
18 {
19 $this->container = $container;
20 }
21
22 private function getTable($tableName)
23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName;
25 }
26
27 /**
28 * @param Schema $schema
29 */
30 public function up(Schema $schema)
31 {
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
33
34 $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD user_id INT(11) DEFAULT NULL');
35 $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');
36 }
37
38 /**
39 * @param Schema $schema
40 */
41 public function down(Schema $schema)
42 {
43
44 }
45}