add link to scope, center, type on Event

This commit is contained in:
Julien Fastré 2016-03-22 14:00:48 +01:00
parent e66a855c0a
commit b89ed5d534

View File

@ -43,6 +43,9 @@ class Version20160318111334 extends AbstractMigration
. 'id INT NOT NULL, ' . 'id INT NOT NULL, '
. 'label VARCHAR(150) NOT NULL, ' . 'label VARCHAR(150) NOT NULL, '
. 'date DATE NOT NULL, ' . 'date DATE NOT NULL, '
. 'center_id INT DEFAULT NULL, '
. 'type_id INT DEFAULT NULL, '
. 'circle_id INT DEFAULT NULL, '
. 'PRIMARY KEY(id))'); . 'PRIMARY KEY(id))');
$this->addSql('CREATE TABLE chill_event_participation (' $this->addSql('CREATE TABLE chill_event_participation ('
. 'id INT NOT NULL, ' . 'id INT NOT NULL, '
@ -56,6 +59,21 @@ class Version20160318111334 extends AbstractMigration
$this->addSql('CREATE INDEX IDX_4E7768AC217BBB47 ON chill_event_participation (person_id)'); $this->addSql('CREATE INDEX IDX_4E7768AC217BBB47 ON chill_event_participation (person_id)');
$this->addSql('CREATE INDEX IDX_4E7768ACD60322AC ON chill_event_participation (role_id)'); $this->addSql('CREATE INDEX IDX_4E7768ACD60322AC ON chill_event_participation (role_id)');
$this->addSql('CREATE INDEX IDX_4E7768AC6BF700BD ON chill_event_participation (status_id)'); $this->addSql('CREATE INDEX IDX_4E7768AC6BF700BD ON chill_event_participation (status_id)');
$this->addSql('CREATE INDEX IDX_FA320FC85932F377 ON chill_event_event (center_id)');
$this->addSql('CREATE INDEX IDX_FA320FC8C54C8C93 ON chill_event_event (type_id)');
$this->addSql('CREATE INDEX IDX_FA320FC870EE2FF6 ON chill_event_event (circle_id)');
$this->addSql('ALTER TABLE chill_event_event '
. 'ADD CONSTRAINT FK_FA320FC85932F377 FOREIGN KEY (center_id) '
. 'REFERENCES centers (id) '
. 'NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_event_event '
. 'ADD CONSTRAINT FK_FA320FC870EE2FF6 FOREIGN KEY (circle_id) '
. 'REFERENCES scopes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_event_event '
. 'ADD CONSTRAINT FK_FA320FC8C54C8C93 FOREIGN KEY (type_id) '
. 'REFERENCES chill_event_event_type (id) '
. 'NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_event_role ' $this->addSql('ALTER TABLE chill_event_role '
. 'ADD CONSTRAINT FK_AA714E54C54C8C93 FOREIGN KEY (type_id) ' . 'ADD CONSTRAINT FK_AA714E54C54C8C93 FOREIGN KEY (type_id) '
. 'REFERENCES chill_event_event_type (id) ' . 'REFERENCES chill_event_event_type (id) '
@ -101,6 +119,13 @@ class Version20160318111334 extends AbstractMigration
$this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768ACD60322AC'); $this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768ACD60322AC');
$this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768AC6BF700BD'); $this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768AC6BF700BD');
$this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768AC71F7E88B'); $this->addSql('ALTER TABLE chill_event_participation DROP CONSTRAINT FK_4E7768AC71F7E88B');
// drop center_id constraint
$this->addSql('ALTER TABLE chill_event_event DROP CONSTRAINT FK_FA320FC85932F377');
// drop type_id constraint
$this->addSql('ALTER TABLE chill_event_event DROP CONSTRAINT FK_FA320FC8C54C8C93');
// drop circle_id constraint
$this->addSql('ALTER TABLE chill_event_event DROP CONSTRAINT FK_FA320FC870EE2FF6');
$this->addSql('DROP SEQUENCE chill_event_event_type_id_seq CASCADE'); $this->addSql('DROP SEQUENCE chill_event_event_type_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_event_role_id_seq CASCADE'); $this->addSql('DROP SEQUENCE chill_event_role_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_event_status_id_seq CASCADE'); $this->addSql('DROP SEQUENCE chill_event_status_id_seq CASCADE');