Adapt entity AccompanyingPeriodParticipation attributes and methods (dont break UI)

This commit is contained in:
2021-03-31 20:57:15 +02:00
parent a98056d31b
commit 01f24ecf1f
7 changed files with 203 additions and 58 deletions

View File

@@ -24,12 +24,16 @@ final class Version20210331084527 extends AbstractMigration
$this->addSql('ALTER TABLE persons_accompanying_periods RENAME TO chill_person_accompanying_period_participation');
// 2
// NOT NECCESSARY $this->addSql('CREATE SEQUENCE chill_person_accompanying_period_participation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
// SERIAL automatically create sequence with NEXTVAL()
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD COLUMN id SERIAL NOT NULL PRIMARY KEY');
// TO CHECK !! automatically complete missing values allowing not null clause
// but add strange "id serial (10) default nextval('chill_person_accompanying_period_participation_id_seq':: regclass )" in column definition
// drop NEXTVAL() in column definition
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER id DROP DEFAULT');
// 3
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD startDate DATE NOT NULL DEFAULT \'1970-01-01\'');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD endDate DATE DEFAULT NULL');
// 4
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f217bbb47');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f550b0c53');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT FK_A59DF89F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
@@ -40,7 +44,7 @@ final class Version20210331084527 extends AbstractMigration
public function down(Schema $schema) : void
{
// 3
// 4
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT FK_A59DF89F217BBB47');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT FK_A59DF89F550B0C53');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT fk_49a3871f217bbb47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
@@ -48,6 +52,10 @@ final class Version20210331084527 extends AbstractMigration
$this->addSql('ALTER INDEX idx_a59df89f550b0c53 RENAME TO idx_49a3871f550b0c53');
$this->addSql('ALTER INDEX idx_a59df89f217bbb47 RENAME TO idx_49a3871f217bbb47');
// 3
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP startDate');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP endDate');
// 2
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_participation_id_seq CASCADE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP id');