SchulIT /
icc
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace DoctrineMigrations; |
||
| 6 | |||
| 7 | use Doctrine\DBAL\Schema\Schema; |
||
| 8 | use Doctrine\Migrations\AbstractMigration; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Auto-generated Migration: Please modify to your needs! |
||
| 12 | */ |
||
| 13 | final class Version20210223204347 extends AbstractMigration |
||
| 14 | { |
||
| 15 | public function getDescription() : string |
||
| 16 | { |
||
| 17 | return ''; |
||
| 18 | } |
||
| 19 | |||
| 20 | public function postUp(Schema $schema): void { |
||
| 21 | for($i = 1; $i <= 53; $i++) { |
||
| 22 | $stmt = $this->connection->prepare('INSERT INTO week (number) VALUES(?)'); |
||
| 23 | $stmt->execute([$i]); |
||
|
0 ignored issues
–
show
|
|||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function up(Schema $schema) : void |
||
| 28 | { |
||
| 29 | // this up() migration is auto-generated, please modify it to your needs |
||
| 30 | $this->addSql('CREATE TABLE timetable_supervision_week (timetable_supervision_id INT UNSIGNED NOT NULL, week_id INT UNSIGNED NOT NULL, INDEX IDX_72D8EF6A2EA503EF (timetable_supervision_id), INDEX IDX_72D8EF6AC86F3B2F (week_id), PRIMARY KEY(timetable_supervision_id, week_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
||
| 31 | $this->addSql('CREATE TABLE timetable_week_week (timetable_week_id INT UNSIGNED NOT NULL, week_id INT UNSIGNED NOT NULL, INDEX IDX_B6951BE6490F7151 (timetable_week_id), INDEX IDX_B6951BE6C86F3B2F (week_id), PRIMARY KEY(timetable_week_id, week_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
||
| 32 | $this->addSql('CREATE TABLE week (id INT UNSIGNED AUTO_INCREMENT NOT NULL, number INT NOT NULL, UNIQUE INDEX UNIQ_5B5A69C096901F54 (number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
||
| 33 | $this->addSql('ALTER TABLE timetable_supervision_week ADD CONSTRAINT FK_72D8EF6A2EA503EF FOREIGN KEY (timetable_supervision_id) REFERENCES timetable_supervision (id) ON DELETE CASCADE'); |
||
| 34 | $this->addSql('ALTER TABLE timetable_supervision_week ADD CONSTRAINT FK_72D8EF6AC86F3B2F FOREIGN KEY (week_id) REFERENCES week (id) ON DELETE CASCADE'); |
||
| 35 | $this->addSql('ALTER TABLE timetable_week_week ADD CONSTRAINT FK_B6951BE6490F7151 FOREIGN KEY (timetable_week_id) REFERENCES timetable_week (id) ON DELETE CASCADE'); |
||
| 36 | $this->addSql('ALTER TABLE timetable_week_week ADD CONSTRAINT FK_B6951BE6C86F3B2F FOREIGN KEY (week_id) REFERENCES week (id) ON DELETE CASCADE'); |
||
| 37 | $this->addSql('ALTER TABLE timetable_supervision DROP FOREIGN KEY FK_396D5F68C86F3B2F'); |
||
| 38 | $this->addSql('DROP INDEX IDX_396D5F68C86F3B2F ON timetable_supervision'); |
||
| 39 | $this->addSql('ALTER TABLE timetable_supervision DROP week_id'); |
||
| 40 | $this->addSql('ALTER TABLE timetable_week DROP week_mod'); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function down(Schema $schema) : void |
||
| 44 | { |
||
| 45 | // this down() migration is auto-generated, please modify it to your needs |
||
| 46 | $this->addSql('ALTER TABLE timetable_supervision_week DROP FOREIGN KEY FK_72D8EF6AC86F3B2F'); |
||
| 47 | $this->addSql('ALTER TABLE timetable_week_week DROP FOREIGN KEY FK_B6951BE6C86F3B2F'); |
||
| 48 | $this->addSql('DROP TABLE timetable_supervision_week'); |
||
| 49 | $this->addSql('DROP TABLE timetable_week_week'); |
||
| 50 | $this->addSql('DROP TABLE week'); |
||
| 51 | $this->addSql('ALTER TABLE timetable_supervision ADD week_id INT UNSIGNED DEFAULT NULL'); |
||
| 52 | $this->addSql('ALTER TABLE timetable_supervision ADD CONSTRAINT FK_396D5F68C86F3B2F FOREIGN KEY (week_id) REFERENCES timetable_week (id) ON DELETE CASCADE'); |
||
| 53 | $this->addSql('CREATE INDEX IDX_396D5F68C86F3B2F ON timetable_supervision (week_id)'); |
||
| 54 | $this->addSql('ALTER TABLE timetable_week ADD week_mod INT NOT NULL'); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.