Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions app/DoctrineMigrations/Version20170803143719.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170803143719 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE profile DROP CONSTRAINT fk_8157aa0f9b6b5fba');
$this->addSql('DROP INDEX uniq_8157aa0f9b6b5fba');
$this->addSql('ALTER TABLE profile DROP account_id');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE profile ADD account_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE profile ADD CONSTRAINT fk_8157aa0f9b6b5fba FOREIGN KEY (account_id) REFERENCES account (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX uniq_8157aa0f9b6b5fba ON profile (account_id)');
}
}
11 changes: 10 additions & 1 deletion app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ services:

app.security.rate_limiter:
class: AppBundle\Security\RateLimiter
arguments: [ "@doctrine.orm.entity_manager" ]
arguments: [ "@doctrine.orm.entity_manager" ]

app.security.account_voter:
class: AppBundle\Security\AccountVoter

app.event_subscriber.account_checker:
class: AppBundle\EventSubscriber\AccountChecker
arguments: [ "@app.security.account_voter", "%security.token_storage%" ]
tags:
- { name: kernel.event_listener, event: kernel.request }
Loading