|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Application\Migrations; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Migrations\AbstractMigration, |
|
6
|
|
|
Doctrine\DBAL\Schema\Schema; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Auto-generated Migration: Please modify to your need! |
|
10
|
|
|
*/ |
|
11
|
|
|
class Version20120910233748 extends AbstractMigration |
|
12
|
|
|
{ |
|
13
|
|
|
public function up(Schema $schema) |
|
14
|
|
|
{ |
|
15
|
|
|
// this up() migration is autogenerated, please modify it to your needs |
|
16
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); |
|
17
|
|
|
|
|
18
|
|
|
// $this->addSql("DROP TABLE ext_log_entries"); |
|
19
|
|
|
// $this->addSql("DROP TABLE ext_translations"); |
|
20
|
|
|
$this->addSql("ALTER TABLE event__mails DROP FOREIGN KEY FK_DBF9BBCB71F7E88B"); |
|
21
|
|
|
$this->addSql("ALTER TABLE event__mails ADD CONSTRAINT FK_DBF9BBCB71F7E88B FOREIGN KEY (event_id) REFERENCES event__events (id) ON DELETE CASCADE"); |
|
22
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E295594C3A3BB"); |
|
23
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E2955971F7E88B"); |
|
24
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E29559A76ED395"); |
|
25
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E295594C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (id) ON DELETE CASCADE"); |
|
26
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E2955971F7E88B FOREIGN KEY (event_id) REFERENCES event__events (id) ON DELETE CASCADE"); |
|
27
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E29559A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE"); |
|
28
|
|
|
$this->addSql("ALTER TABLE payments DROP FOREIGN KEY FK_65D29B32A76ED395"); |
|
29
|
|
|
$this->addSql("ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE"); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function down(Schema $schema) |
|
33
|
|
|
{ |
|
34
|
|
|
// this down() migration is autogenerated, please modify it to your needs |
|
35
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); |
|
36
|
|
|
|
|
37
|
|
|
// $this->addSql("CREATE TABLE ext_log_entries (id INT AUTO_INCREMENT NOT NULL, action VARCHAR(8) NOT NULL, logged_at DATETIME NOT NULL, object_id VARCHAR(32) DEFAULT NULL, object_class VARCHAR(255) NOT NULL, version INT NOT NULL, data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', username VARCHAR(255) DEFAULT NULL, INDEX log_class_lookup_idx (object_class), INDEX log_date_lookup_idx (logged_at), INDEX log_user_lookup_idx (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB"); |
|
38
|
|
|
// $this->addSql("CREATE TABLE ext_translations (id INT AUTO_INCREMENT NOT NULL, locale VARCHAR(8) NOT NULL, object_class VARCHAR(255) NOT NULL, field VARCHAR(32) NOT NULL, foreign_key VARCHAR(64) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX lookup_unique_idx (locale, object_class, foreign_key, field), INDEX translations_lookup_idx (locale, object_class, foreign_key), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB"); |
|
39
|
|
|
$this->addSql("ALTER TABLE event__mails DROP FOREIGN KEY FK_DBF9BBCB71F7E88B"); |
|
40
|
|
|
$this->addSql("ALTER TABLE event__mails ADD CONSTRAINT FK_DBF9BBCB71F7E88B FOREIGN KEY (event_id) REFERENCES event__events (id) ON UPDATE CASCADE ON DELETE CASCADE"); |
|
41
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E2955971F7E88B"); |
|
42
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E29559A76ED395"); |
|
43
|
|
|
$this->addSql("ALTER TABLE event__tickets DROP FOREIGN KEY FK_66E295594C3A3BB"); |
|
44
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E2955971F7E88B FOREIGN KEY (event_id) REFERENCES event__events (id) ON UPDATE CASCADE ON DELETE CASCADE"); |
|
45
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E29559A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON UPDATE CASCADE ON DELETE CASCADE"); |
|
46
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD CONSTRAINT FK_66E295594C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (id) ON UPDATE CASCADE ON DELETE CASCADE"); |
|
47
|
|
|
$this->addSql("ALTER TABLE payments DROP FOREIGN KEY FK_65D29B32A76ED395"); |
|
48
|
|
|
$this->addSql("ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON UPDATE CASCADE ON DELETE CASCADE"); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|