Task #27629 » Version20110621193235.php

Doctrine Migration - Bastian Waidelich, 2011-06-21 19:48

 
1
<?php
2
namespace F3\FLOW3\Persistence\Doctrine\Migrations;
3

    
4
use Doctrine\DBAL\Migrations\AbstractMigration,
5
	Doctrine\DBAL\Schema\Schema;
6

    
7
/**
8
 * Auto-generated Migration: Please modify to your need!
9
 */
10
class Version20110621193235 extends AbstractMigration {
11

    
12
	/**
13
	 * @param Schema $schema
14
	 * @return void
15
	 */
16
	public function up(Schema $schema) {
17
			// this up() migration is autogenerated, please modify it to your needs
18
		$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
19
		
20
		$this->addSql("ALTER TABLE conference_conference ADD FOREIGN KEY (conference_conference_location) REFERENCES conference_conference_location(flow3_persistence_identifier)");
21
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join CHANGE conference_conference_sessiontype conference_conference_sessiontype VARCHAR(40) NOT NULL");
22
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join DROP FOREIGN KEY conference_conference_sessiontypes_join_ibfk_2");
23
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join ADD FOREIGN KEY (conference_conference_sessiontype) REFERENCES conference_conference_sessiontype(flow3_persistence_identifier)");
24
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join CHANGE conference_conference_intermissiontype conference_conference_intermissiontype VARCHAR(40) NOT NULL");
25
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join DROP FOREIGN KEY conference_conference_intermissiontypes_join_ibfk_2");
26
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join ADD FOREIGN KEY (conference_conference_intermissiontype) REFERENCES conference_conference_intermissiontype(flow3_persistence_identifier)");
27
		$this->addSql("ALTER TABLE conference_conference_abstractactivity CHANGE conference_location_room conference_location_room VARCHAR(40) DEFAULT NULL");
28
		$this->addSql("ALTER TABLE conference_conference_abstractactivity DROP FOREIGN KEY conference_conference_abstractactivity_ibfk_1");
29
		$this->addSql("ALTER TABLE conference_conference_abstractactivity ADD FOREIGN KEY (conference_location_room) REFERENCES conference_location_room(flow3_persistence_identifier)");
30
		$this->addSql("ALTER TABLE conference_conference_intermission CHANGE conference_conference_intermissiontype conference_conference_intermissiontype VARCHAR(40) DEFAULT NULL");
31
		$this->addSql("ALTER TABLE conference_conference_intermission DROP FOREIGN KEY conference_conference_intermission_ibfk_1");
32
		$this->addSql("ALTER TABLE conference_conference_intermission ADD FOREIGN KEY (conference_conference_intermissiontype) REFERENCES conference_conference_intermissiontype(flow3_persistence_identifier)");
33
		$this->addSql("ALTER TABLE conference_conference_paper CHANGE conference_conference_sessiontype conference_conference_sessiontype VARCHAR(40) DEFAULT NULL");
34
		$this->addSql("ALTER TABLE conference_conference_paper DROP FOREIGN KEY conference_conference_paper_ibfk_2");
35
		$this->addSql("ALTER TABLE conference_conference_paper ADD FOREIGN KEY (conference_conference_sessiontype) REFERENCES conference_conference_sessiontype(flow3_persistence_identifier)");
36
		$this->addSql("ALTER TABLE flow3_resource_resource CHANGE flow3_resource_resourcepointer flow3_resource_resourcepointer VARCHAR(255) DEFAULT NULL");
37
		$this->addSql("ALTER TABLE conference_conference_intermissiontype ADD flow3_persistence_identifier VARCHAR(40) NOT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL");
38
		$this->addSql("DROP INDEX primary ON conference_conference_intermissiontype");
39
		$this->addSql("CREATE UNIQUE INDEX primary ON conference_conference_intermissiontype (flow3_persistence_identifier)");
40
		$this->addSql("ALTER TABLE conference_conference_location ADD flow3_persistence_identifier VARCHAR(40) NOT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL");
41
		$this->addSql("DROP INDEX primary ON conference_conference_location");
42
		$this->addSql("CREATE UNIQUE INDEX primary ON conference_conference_location (flow3_persistence_identifier)");
43
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join CHANGE conference_conference_location conference_conference_location VARCHAR(40) NOT NULL, CHANGE conference_location_room conference_location_room VARCHAR(40) NOT NULL");
44
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join DROP FOREIGN KEY conference_conference_location_rooms_join_ibfk_2");
45
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join DROP FOREIGN KEY conference_conference_location_rooms_join_ibfk_1");
46
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join ADD FOREIGN KEY (conference_conference_location) REFERENCES conference_conference_location(flow3_persistence_identifier)");
47
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join ADD FOREIGN KEY (conference_location_room) REFERENCES conference_location_room(flow3_persistence_identifier)");
48
		$this->addSql("ALTER TABLE conference_location_room ADD flow3_persistence_identifier VARCHAR(40) NOT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL");
49
		$this->addSql("DROP INDEX primary ON conference_location_room");
50
		$this->addSql("CREATE UNIQUE INDEX primary ON conference_location_room (flow3_persistence_identifier)");
51
		$this->addSql("ALTER TABLE conference_conference_sessiontype ADD flow3_persistence_identifier VARCHAR(40) NOT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL");
52
		$this->addSql("DROP INDEX primary ON conference_conference_sessiontype");
53
		$this->addSql("CREATE UNIQUE INDEX primary ON conference_conference_sessiontype (flow3_persistence_identifier)");
54
	}
55

    
56
	/**
57
	 * @param Schema $schema
58
	 * @return void
59
	 */
60
	public function down(Schema $schema) {
61
			// this down() migration is autogenerated, please modify it to your needs
62
		$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
63
		
64
		$this->addSql("ALTER TABLE conference_conference DROP FOREIGN KEY ");
65
		$this->addSql("ALTER TABLE conference_conference_abstractactivity CHANGE conference_location_room conference_location_room VARCHAR(255) DEFAULT NULL");
66
		$this->addSql("ALTER TABLE conference_conference_abstractactivity DROP FOREIGN KEY ");
67
		$this->addSql("ALTER TABLE conference_conference_abstractactivity ADD CONSTRAINT conference_conference_abstractactivity_ibfk_1 FOREIGN KEY (conference_location_room) REFERENCES conference_location_room(title)");
68
		$this->addSql("ALTER TABLE conference_conference_intermission CHANGE conference_conference_intermissiontype conference_conference_intermissiontype VARCHAR(255) DEFAULT NULL");
69
		$this->addSql("ALTER TABLE conference_conference_intermission DROP FOREIGN KEY ");
70
		$this->addSql("ALTER TABLE conference_conference_intermission ADD CONSTRAINT conference_conference_intermission_ibfk_1 FOREIGN KEY (conference_conference_intermissiontype) REFERENCES conference_conference_intermissiontype(title)");
71
		$this->addSql("ALTER TABLE conference_conference_intermissiontype DROP flow3_persistence_identifier, CHANGE title title VARCHAR(255) NOT NULL");
72
		$this->addSql("DROP INDEX PRIMARY ON conference_conference_intermissiontype");
73
		$this->addSql("CREATE UNIQUE INDEX PRIMARY ON conference_conference_intermissiontype (title)");
74
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join CHANGE conference_conference_intermissiontype conference_conference_intermissiontype VARCHAR(255) NOT NULL");
75
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join DROP FOREIGN KEY ");
76
		$this->addSql("ALTER TABLE conference_conference_intermissiontypes_join ADD CONSTRAINT conference_conference_intermissiontypes_join_ibfk_2 FOREIGN KEY (conference_conference_intermissiontype) REFERENCES conference_conference_intermissiontype(title)");
77
		$this->addSql("ALTER TABLE conference_conference_location DROP flow3_persistence_identifier, CHANGE title title VARCHAR(255) NOT NULL");
78
		$this->addSql("DROP INDEX PRIMARY ON conference_conference_location");
79
		$this->addSql("CREATE UNIQUE INDEX PRIMARY ON conference_conference_location (title)");
80
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join CHANGE conference_conference_location conference_conference_location VARCHAR(255) NOT NULL, CHANGE conference_location_room conference_location_room VARCHAR(255) NOT NULL");
81
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join DROP FOREIGN KEY ");
82
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join DROP FOREIGN KEY ");
83
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join ADD CONSTRAINT conference_conference_location_rooms_join_ibfk_2 FOREIGN KEY (conference_location_room) REFERENCES conference_location_room(title)");
84
		$this->addSql("ALTER TABLE conference_conference_location_rooms_join ADD CONSTRAINT conference_conference_location_rooms_join_ibfk_1 FOREIGN KEY (conference_conference_location) REFERENCES conference_conference_location(title)");
85
		$this->addSql("ALTER TABLE conference_conference_paper CHANGE conference_conference_sessiontype conference_conference_sessiontype VARCHAR(255) DEFAULT NULL");
86
		$this->addSql("ALTER TABLE conference_conference_paper DROP FOREIGN KEY ");
87
		$this->addSql("ALTER TABLE conference_conference_paper ADD CONSTRAINT conference_conference_paper_ibfk_2 FOREIGN KEY (conference_conference_sessiontype) REFERENCES conference_conference_sessiontype(title)");
88
		$this->addSql("ALTER TABLE conference_conference_sessiontype DROP flow3_persistence_identifier, CHANGE title title VARCHAR(255) NOT NULL");
89
		$this->addSql("DROP INDEX PRIMARY ON conference_conference_sessiontype");
90
		$this->addSql("CREATE UNIQUE INDEX PRIMARY ON conference_conference_sessiontype (title)");
91
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join CHANGE conference_conference_sessiontype conference_conference_sessiontype VARCHAR(255) NOT NULL");
92
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join DROP FOREIGN KEY ");
93
		$this->addSql("ALTER TABLE conference_conference_sessiontypes_join ADD CONSTRAINT conference_conference_sessiontypes_join_ibfk_2 FOREIGN KEY (conference_conference_sessiontype) REFERENCES conference_conference_sessiontype(title)");
94
		$this->addSql("ALTER TABLE conference_location_room DROP flow3_persistence_identifier, CHANGE title title VARCHAR(255) NOT NULL");
95
		$this->addSql("DROP INDEX PRIMARY ON conference_location_room");
96
		$this->addSql("CREATE UNIQUE INDEX PRIMARY ON conference_location_room (title)");
97
		$this->addSql("ALTER TABLE flow3_resource_resource CHANGE flow3_resource_resourcepointer flow3_resource_resourcepointer VARCHAR(255) DEFAULT NULL");
98
	}
99
}
100

    
101
?>
    (1-1/1)