From 4770758aeeb5cc204129a068dc81a3785143415b Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 6 May 2021 12:36:58 +0200 Subject: [PATCH] add migrations for addresse on household + add linkedtothirdparty on address --- .../migrations/Version20210505153727.php | 33 +++++++++++++++++++ .../migrations/Version20210505154316.php | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20210505153727.php create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20210505154316.php diff --git a/src/Bundle/ChillMainBundle/migrations/Version20210505153727.php b/src/Bundle/ChillMainBundle/migrations/Version20210505153727.php new file mode 100644 index 000000000..c1fff5b9e --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20210505153727.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE chill_main_address ADD linkedToThirdParty_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_main_address ADD CONSTRAINT FK_165051F6114B8DD9 FOREIGN KEY (linkedToThirdParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_165051F6114B8DD9 ON chill_main_address (linkedToThirdParty_id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT FK_165051F6114B8DD9'); + $this->addSql('DROP INDEX IDX_165051F6114B8DD9'); + $this->addSql('ALTER TABLE chill_main_address DROP linkedToThirdParty_id'); + } +} diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210505154316.php b/src/Bundle/ChillPersonBundle/migrations/Version20210505154316.php new file mode 100644 index 000000000..bb3a56337 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210505154316.php @@ -0,0 +1,33 @@ +addSql('CREATE TABLE chill_person_household_to_addresses (household_id INT NOT NULL, address_id INT NOT NULL, PRIMARY KEY(household_id, address_id))'); + $this->addSql('CREATE INDEX IDX_7109483E79FF843 ON chill_person_household_to_addresses (household_id)'); + $this->addSql('CREATE INDEX IDX_7109483F5B7AF75 ON chill_person_household_to_addresses (address_id)'); + $this->addSql('ALTER TABLE chill_person_household_to_addresses ADD CONSTRAINT FK_7109483E79FF843 FOREIGN KEY (household_id) REFERENCES Household (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_person_household_to_addresses ADD CONSTRAINT FK_7109483F5B7AF75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP TABLE chill_person_household_to_addresses'); + } +}