From b89ed5d534593458389c1022095bceee04376641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 22 Mar 2016 14:00:48 +0100 Subject: [PATCH] add link to scope, center, type on Event --- .../migrations/Version20160318111334.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Resources/migrations/Version20160318111334.php b/Resources/migrations/Version20160318111334.php index 6ab4d5004..fe23df743 100644 --- a/Resources/migrations/Version20160318111334.php +++ b/Resources/migrations/Version20160318111334.php @@ -43,6 +43,9 @@ class Version20160318111334 extends AbstractMigration . 'id INT NOT NULL, ' . 'label VARCHAR(150) NOT NULL, ' . 'date DATE NOT NULL, ' + . 'center_id INT DEFAULT NULL, ' + . 'type_id INT DEFAULT NULL, ' + . 'circle_id INT DEFAULT NULL, ' . 'PRIMARY KEY(id))'); $this->addSql('CREATE TABLE chill_event_participation (' . '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_4E7768ACD60322AC ON chill_event_participation (role_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 ' . 'ADD CONSTRAINT FK_AA714E54C54C8C93 FOREIGN KEY (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_4E7768AC6BF700BD'); $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_role_id_seq CASCADE'); $this->addSql('DROP SEQUENCE chill_event_status_id_seq CASCADE');