|
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 Version20170411152812 extends AbstractMigration |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @param Schema $schema |
|
15
|
|
|
*/ |
|
16
|
|
|
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('CREATE TABLE performanceevent_rowsforsale (performanceevent_id INT NOT NULL, rowsforsale_id INT NOT NULL, INDEX IDX_4B0B0CD3A663E1AC (performanceevent_id), INDEX IDX_4B0B0CD3A26F6674 (rowsforsale_id), PRIMARY KEY(performanceevent_id, rowsforsale_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
|
22
|
|
|
$this->addSql('CREATE TABLE rows_for_sale (id INT AUTO_INCREMENT NOT NULL, row INT NOT NULL, venueSector_id INT DEFAULT NULL, INDEX IDX_BB4AF581137F3880 (venueSector_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
|
23
|
|
|
$this->addSql('CREATE TABLE rows_for_sale_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_AA8BD619232D562B (object_id), UNIQUE INDEX lookup_unique_rows_for_sale_translation_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
|
24
|
|
|
$this->addSql('ALTER TABLE performanceevent_rowsforsale ADD CONSTRAINT FK_4B0B0CD3A663E1AC FOREIGN KEY (performanceevent_id) REFERENCES performance_schedule (id) ON DELETE CASCADE'); |
|
25
|
|
|
$this->addSql('ALTER TABLE performanceevent_rowsforsale ADD CONSTRAINT FK_4B0B0CD3A26F6674 FOREIGN KEY (rowsforsale_id) REFERENCES rows_for_sale (id) ON DELETE CASCADE'); |
|
26
|
|
|
$this->addSql('ALTER TABLE rows_for_sale ADD CONSTRAINT FK_BB4AF581137F3880 FOREIGN KEY (venueSector_id) REFERENCES venue_sector (id)'); |
|
27
|
|
|
$this->addSql('ALTER TABLE rows_for_sale_translation ADD CONSTRAINT FK_AA8BD619232D562B FOREIGN KEY (object_id) REFERENCES rows_for_sale (id) ON DELETE CASCADE'); |
|
28
|
|
|
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA31C7C4AAD'); |
|
29
|
|
|
$this->addSql('DROP INDEX IDX_97A0ADA31C7C4AAD ON ticket'); |
|
30
|
|
|
$this->addSql('ALTER TABLE ticket CHANGE customer_order_id customer_order_id INT DEFAULT NULL'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param Schema $schema |
|
35
|
|
|
*/ |
|
36
|
|
|
public function down(Schema $schema) |
|
37
|
|
|
{ |
|
38
|
|
|
// this down() migration is auto-generated, please modify it to your needs |
|
39
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
40
|
|
|
|
|
41
|
|
|
$this->addSql('ALTER TABLE performanceevent_rowsforsale DROP FOREIGN KEY FK_4B0B0CD3A26F6674'); |
|
42
|
|
|
$this->addSql('ALTER TABLE rows_for_sale_translation DROP FOREIGN KEY FK_AA8BD619232D562B'); |
|
43
|
|
|
$this->addSql('DROP TABLE performanceevent_rowsforsale'); |
|
44
|
|
|
$this->addSql('DROP TABLE rows_for_sale'); |
|
45
|
|
|
$this->addSql('DROP TABLE rows_for_sale_translation'); |
|
46
|
|
|
$this->addSql('ALTER TABLE ticket CHANGE customer_order_id customer_order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary)\''); |
|
47
|
|
|
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA31C7C4AAD FOREIGN KEY (customer_order_id) REFERENCES customer_order (id)'); |
|
48
|
|
|
$this->addSql('CREATE INDEX IDX_97A0ADA31C7C4AAD ON ticket (customer_order_id)'); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|