|
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 Version20111024220034 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("ALTER TABLE event__events ADD city VARCHAR(255) DEFAULT NULL, ADD place VARCHAR(255) DEFAULT NULL, ADD date DATETIME DEFAULT NULL, DROP title, CHANGE about about LONGTEXT DEFAULT NULL"); |
|
19
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP status"); |
|
20
|
|
|
$this->addSql("CREATE INDEX IDX_66E2955971F7E88B ON event__tickets (event_id)"); |
|
21
|
|
|
$this->addSql("CREATE INDEX IDX_66E29559A76ED395 ON event__tickets (user_id)"); |
|
22
|
|
|
$this->addSql("CREATE INDEX IDX_66E295594C3A3BB ON event__tickets (payment_id)"); |
|
23
|
|
|
// $this->addSql("DROP INDEX UNIQ_66E2955971F7E88B ON event__tickets"); |
|
24
|
|
|
// $this->addSql("DROP INDEX UNIQ_66E295594C3A3BB ON event__tickets"); |
|
25
|
|
|
// $this->addSql("DROP INDEX UNIQ_66E29559A76ED395 ON event__tickets"); |
|
26
|
|
|
$this->addSql("ALTER TABLE payments ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE sum amount NUMERIC(10, 2) NOT NULL"); |
|
27
|
|
|
$this->addSql("ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users(id)"); |
|
28
|
|
|
$this->addSql("CREATE INDEX IDX_65D29B32A76ED395 ON payments (user_id)"); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function down(Schema $schema) |
|
32
|
|
|
{ |
|
33
|
|
|
// this down() migration is autogenerated, please modify it to your needs |
|
34
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); |
|
35
|
|
|
|
|
36
|
|
|
$this->addSql("ALTER TABLE event__events ADD title VARCHAR(255) NOT NULL, DROP city, DROP place, DROP date, CHANGE about about LONGTEXT NOT NULL"); |
|
37
|
|
|
$this->addSql("DROP INDEX IDX_66E2955971F7E88B ON event__tickets"); |
|
38
|
|
|
$this->addSql("DROP INDEX IDX_66E29559A76ED395 ON event__tickets"); |
|
39
|
|
|
$this->addSql("DROP INDEX IDX_66E295594C3A3BB ON event__tickets"); |
|
40
|
|
|
$this->addSql("ALTER TABLE event__tickets ADD status VARCHAR(255) NOT NULL, DROP created_at, DROP updated_at"); |
|
41
|
|
|
// $this->addSql("CREATE UNIQUE INDEX UNIQ_66E2955971F7E88B ON event__tickets (event_id)"); |
|
42
|
|
|
// $this->addSql("CREATE UNIQUE INDEX UNIQ_66E295594C3A3BB ON event__tickets (payment_id)"); |
|
43
|
|
|
// $this->addSql("CREATE UNIQUE INDEX UNIQ_66E29559A76ED395 ON event__tickets (user_id)"); |
|
44
|
|
|
$this->addSql("ALTER TABLE payments DROP FOREIGN KEY FK_65D29B32A76ED395"); |
|
45
|
|
|
$this->addSql("DROP INDEX IDX_65D29B32A76ED395 ON payments"); |
|
46
|
|
|
$this->addSql("ALTER TABLE payments DROP created_at, DROP updated_at, CHANGE user_id user_id INT NOT NULL, CHANGE amount sum NUMERIC(10, 0) NOT NULL"); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|