1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Application\Migrations; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Migrations\AbstractMigration; |
6
|
|
|
use Doctrine\DBAL\Schema\Schema; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Auto-generated Migration: Please modify to your needs! |
10
|
|
|
*/ |
11
|
|
|
class Version20170330115601 extends AbstractMigration |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @param Schema $schema |
15
|
|
|
*/ |
16
|
|
View Code Duplication |
public function up(Schema $schema) |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
// this up() migration is auto-generated, please modify it to your needs |
19
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
20
|
|
|
|
21
|
|
|
$this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D640A73EBA'); |
22
|
|
|
$this->addSql('DROP INDEX IDX_64FA22D640A73EBA ON price_category'); |
23
|
|
|
$this->addSql('ALTER TABLE price_category ADD places VARCHAR(255) NOT NULL, ADD price INT NOT NULL, ADD venueSector_id INT DEFAULT NULL, CHANGE color color VARCHAR(255) DEFAULT \'grey\' NOT NULL, CHANGE title rows VARCHAR(255) NOT NULL, CHANGE venue_id performanceEvent_id INT DEFAULT NULL'); |
24
|
|
|
$this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D65F1583FA FOREIGN KEY (performanceEvent_id) REFERENCES performance_schedule (id)'); |
25
|
|
|
$this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D6137F3880 FOREIGN KEY (venueSector_id) REFERENCES venue_sector (id)'); |
26
|
|
|
$this->addSql('CREATE INDEX IDX_64FA22D65F1583FA ON price_category (performanceEvent_id)'); |
27
|
|
|
$this->addSql('CREATE INDEX IDX_64FA22D6137F3880 ON price_category (venueSector_id)'); |
28
|
|
|
$this->addSql('ALTER TABLE seat DROP FOREIGN KEY FK_3D5C36664319ED49'); |
29
|
|
|
$this->addSql('DROP INDEX IDX_3D5C36664319ED49 ON seat'); |
30
|
|
|
$this->addSql('ALTER TABLE seat DROP priceCategory_id'); |
31
|
|
|
$this->addSql('ALTER TABLE customer_order CHANGE status status enum(\'free\', \'booked\', \'ordered\', \'opened\', \'closed\')'); |
32
|
|
|
$this->addSql('ALTER TABLE ticket CHANGE status status enum(\'free\', \'booked\', \'paid\', \'offline\')'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param Schema $schema |
37
|
|
|
*/ |
38
|
|
View Code Duplication |
public function down(Schema $schema) |
|
|
|
|
39
|
|
|
{ |
40
|
|
|
// this down() migration is auto-generated, please modify it to your needs |
41
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
42
|
|
|
|
43
|
|
|
$this->addSql('ALTER TABLE customer_order CHANGE status status VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci'); |
44
|
|
|
$this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D65F1583FA'); |
45
|
|
|
$this->addSql('ALTER TABLE price_category DROP FOREIGN KEY FK_64FA22D6137F3880'); |
46
|
|
|
$this->addSql('DROP INDEX IDX_64FA22D65F1583FA ON price_category'); |
47
|
|
|
$this->addSql('DROP INDEX IDX_64FA22D6137F3880 ON price_category'); |
48
|
|
|
$this->addSql('ALTER TABLE price_category ADD venue_id INT DEFAULT NULL, ADD title VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, DROP rows, DROP places, DROP price, DROP performanceEvent_id, DROP venueSector_id, CHANGE color color VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci'); |
49
|
|
|
$this->addSql('ALTER TABLE price_category ADD CONSTRAINT FK_64FA22D640A73EBA FOREIGN KEY (venue_id) REFERENCES venue (id)'); |
50
|
|
|
$this->addSql('CREATE INDEX IDX_64FA22D640A73EBA ON price_category (venue_id)'); |
51
|
|
|
$this->addSql('ALTER TABLE seat ADD priceCategory_id INT DEFAULT NULL'); |
52
|
|
|
$this->addSql('ALTER TABLE seat ADD CONSTRAINT FK_3D5C36664319ED49 FOREIGN KEY (priceCategory_id) REFERENCES price_category (id)'); |
53
|
|
|
$this->addSql('CREATE INDEX IDX_3D5C36664319ED49 ON seat (priceCategory_id)'); |
54
|
|
|
$this->addSql('ALTER TABLE ticket CHANGE status status VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci'); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.