1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace DoctrineMigrations; |
6
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Schema\Schema; |
8
|
|
|
use Doctrine\Migrations\AbstractMigration; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Auto-generated Migration: Please modify to your needs! |
12
|
|
|
*/ |
13
|
|
|
final class Version20191024200214 extends AbstractMigration |
14
|
|
|
{ |
15
|
|
|
public function getDescription() : string |
16
|
|
|
{ |
17
|
|
|
return ''; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function up(Schema $schema) : void |
21
|
|
|
{ |
22
|
|
|
// this up() migration is auto-generated, please modify it to your needs |
23
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
24
|
|
|
|
25
|
|
|
$this->addSql('ALTER TABLE accounting_journal_moves ADD CONSTRAINT FK_C68D82A7597D3FE FOREIGN KEY (member_id) REFERENCES parking_members (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
26
|
|
|
$this->addSql('ALTER TABLE accounting_journal_moves ADD CONSTRAINT FK_C68D82A478E8802 FOREIGN KEY (journal_id) REFERENCES accounting_journals (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
27
|
|
|
$this->addSql('ALTER TABLE accounting_journals ADD CONSTRAINT FK_AB267833478E8802 FOREIGN KEY (journal_id) REFERENCES accounting_tasks (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
28
|
|
|
$this->addSql('ALTER TABLE parking_member_needs ADD CONSTRAINT FK_899A921E7597D3FE FOREIGN KEY (member_id) REFERENCES parking_members (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
29
|
|
|
$this->addSql('ALTER TABLE parking_memberships ADD CONSTRAINT FK_DAF589A27597D3FE FOREIGN KEY (member_id) REFERENCES parking_members (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
30
|
|
|
$this->addSql('ALTER TABLE parking_reservations ADD CONSTRAINT FK_81AF1B3A7597D3FE FOREIGN KEY (member_id) REFERENCES parking_members (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
31
|
|
|
$this->addSql('ALTER TABLE parking_members ADD CONSTRAINT FK_CB4A2A25A76ED395 FOREIGN KEY (user_id) REFERENCES access_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
32
|
|
|
$this->addSql('ALTER TABLE access_slack_identities ADD CONSTRAINT FK_5B43A04A76ED395 FOREIGN KEY (user_id) REFERENCES access_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
33
|
|
|
$this->addSql('ALTER TABLE access_google_identities ADD CONSTRAINT FK_A12BAC6A76ED395 FOREIGN KEY (user_id) REFERENCES access_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
34
|
|
|
$this->addSql('ALTER TABLE system_request_log_details ADD CONSTRAINT FK_4F124CF4A13E9E7D FOREIGN KEY (request_log_id) REFERENCES system_request_logs (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
35
|
|
|
$this->addSql('ALTER TABLE system_request_logs RENAME COLUMN "group" TO base_path'); |
36
|
|
|
$this->addSql('ALTER TABLE system_request_logs ADD CONSTRAINT FK_9C1BC9AB7597D3FE FOREIGN KEY (member_id) REFERENCES parking_members (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function down(Schema $schema) : void |
40
|
|
|
{ |
41
|
|
|
// this down() migration is auto-generated, please modify it to your needs |
42
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); |
43
|
|
|
|
44
|
|
|
$this->addSql('CREATE SCHEMA public'); |
45
|
|
|
$this->addSql('ALTER TABLE system_request_logs DROP CONSTRAINT FK_9C1BC9AB7597D3FE'); |
46
|
|
|
$this->addSql('ALTER TABLE system_request_logs RENAME COLUMN base_path TO "group"'); |
47
|
|
|
$this->addSql('ALTER TABLE parking_member_needs DROP CONSTRAINT FK_899A921E7597D3FE'); |
48
|
|
|
$this->addSql('ALTER TABLE parking_reservations DROP CONSTRAINT FK_81AF1B3A7597D3FE'); |
49
|
|
|
$this->addSql('ALTER TABLE access_slack_identities DROP CONSTRAINT FK_5B43A04A76ED395'); |
50
|
|
|
$this->addSql('ALTER TABLE parking_members DROP CONSTRAINT FK_CB4A2A25A76ED395'); |
51
|
|
|
$this->addSql('ALTER TABLE access_google_identities DROP CONSTRAINT FK_A12BAC6A76ED395'); |
52
|
|
|
$this->addSql('ALTER TABLE accounting_journal_moves DROP CONSTRAINT FK_C68D82A7597D3FE'); |
53
|
|
|
$this->addSql('ALTER TABLE accounting_journal_moves DROP CONSTRAINT FK_C68D82A478E8802'); |
54
|
|
|
$this->addSql('ALTER TABLE parking_memberships DROP CONSTRAINT FK_DAF589A27597D3FE'); |
55
|
|
|
$this->addSql('ALTER TABLE accounting_journals DROP CONSTRAINT FK_AB267833478E8802'); |
56
|
|
|
$this->addSql('ALTER TABLE system_request_log_details DROP CONSTRAINT FK_4F124CF4A13E9E7D'); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|