@@ 10-65 (lines=56) @@ | ||
7 | use Doctrine\DBAL\Schema\Schema; |
|
8 | use Doctrine\Migrations\AbstractMigration; |
|
9 | ||
10 | final class Version20210109113511 extends AbstractMigration |
|
11 | { |
|
12 | public function getDescription() : string |
|
13 | { |
|
14 | return 'Added stuff categories to employee entity'; |
|
15 | } |
|
16 | ||
17 | public function up(Schema $schema) : void |
|
18 | { |
|
19 | $this->addSql(' |
|
20 | ALTER TABLE employees |
|
21 | ADD staff |
|
22 | ENUM(\'art-core\', \'art-production\', \'administrative\', \'creative\', \'invited\') |
|
23 | DEFAULT \'creative\' NOT NULL COMMENT \'(DC2Type:EmployeeStaffEnum)\' |
|
24 | '); |
|
25 | ||
26 | $this->addSql(' |
|
27 | UPDATE employees |
|
28 | SET `staff` = \'art-core\' |
|
29 | WHERE `position` IN ( |
|
30 | \'acting_artistic_director\', |
|
31 | \'conductor\', |
|
32 | \'costumer\', |
|
33 | \'head_of_the_literary_and_dramatic_part\' |
|
34 | ) |
|
35 | '); |
|
36 | ||
37 | $this->addSql(' |
|
38 | UPDATE employees |
|
39 | SET `staff` = \'art-production\' |
|
40 | WHERE `position` IN ( |
|
41 | \'art_director\', |
|
42 | \'costumer\', |
|
43 | \'leading_artist_scene\', |
|
44 | \'main_artist\', |
|
45 | \'main_choreographer\', |
|
46 | \'stage_manager\', |
|
47 | \'head_of_the_literary_and_dramatic_part\' |
|
48 | ) |
|
49 | '); |
|
50 | ||
51 | $this->addSql(' |
|
52 | UPDATE employees |
|
53 | SET `staff` = \'administrative\' |
|
54 | WHERE `position` IN ( |
|
55 | \'theatre_director\', |
|
56 | \'theatre_director_art_director\' |
|
57 | ) |
|
58 | '); |
|
59 | } |
|
60 | ||
61 | public function down(Schema $schema) : void |
|
62 | { |
|
63 | $this->addSql('ALTER TABLE employees DROP staff'); |
|
64 | } |
|
65 | } |
|
66 |
@@ 10-30 (lines=21) @@ | ||
7 | use Doctrine\DBAL\Schema\Schema; |
|
8 | use Doctrine\Migrations\AbstractMigration; |
|
9 | ||
10 | final class Version20210504022820 extends AbstractMigration |
|
11 | { |
|
12 | public function getDescription() : string |
|
13 | { |
|
14 | return 'Employees Group table migration'; |
|
15 | } |
|
16 | ||
17 | public function up(Schema $schema) : void |
|
18 | { |
|
19 | $this->addSql('CREATE TABLE employee_group_translation (id INT AUTO_INCREMENT NOT NULL, object_id INT DEFAULT NULL, locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_97B6048F232D562B (object_id), UNIQUE INDEX lookup_unique_employee_group_translation_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
|
20 | $this->addSql('CREATE TABLE employees_group (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, position INT NOT NULL, createdAt DATETIME NOT NULL, updatedAt DATETIME DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, createdBy VARCHAR(255) DEFAULT NULL, updatedBy VARCHAR(255) DEFAULT NULL, deletedBy VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
|
21 | $this->addSql('ALTER TABLE employee_group_translation ADD CONSTRAINT FK_97B6048F232D562B FOREIGN KEY (object_id) REFERENCES employees_group (id) ON DELETE CASCADE'); |
|
22 | $this->addSql('ALTER TABLE employees ADD employeeGroup_id INT'); |
|
23 | $this->addSql('ALTER TABLE employees ADD CONSTRAINT FK_BA82C300F3260C63 FOREIGN KEY (employeeGroup_id) REFERENCES employees_group (id) ON DELETE SET NULL'); |
|
24 | $this->addSql('CREATE INDEX IDX_BA82C300F3260C63 ON employees (employeeGroup_id)'); |
|
25 | } |
|
26 | ||
27 | public function down(Schema $schema) : void |
|
28 | { |
|
29 | } |
|
30 | } |
|
31 |