| @@ 11-42 (lines=32) @@ | ||
| 8 | /** |
|
| 9 | * Auto-generated Migration: Please modify to your needs! |
|
| 10 | */ |
|
| 11 | class Version20150305134846 extends AbstractMigration |
|
| 12 | { |
|
| 13 | public function up(Schema $schema) |
|
| 14 | { |
|
| 15 | // this up() migration is auto-generated, please modify it to your needs |
|
| 16 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
| 17 | ||
| 18 | $this->addSql('ALTER TABLE ra_second_factor ADD status_int INT NOT NULL'); |
|
| 19 | $this->addSql('UPDATE ra_second_factor SET status_int=0 WHERE `status`="unverified"'); |
|
| 20 | $this->addSql('UPDATE ra_second_factor SET status_int=10 WHERE `status`="verified"'); |
|
| 21 | $this->addSql('UPDATE ra_second_factor SET status_int=20 WHERE `status`="vetted"'); |
|
| 22 | $this->addSql('UPDATE ra_second_factor SET status_int=30 WHERE `status`="revoked"'); |
|
| 23 | $this->addSql('ALTER TABLE ra_second_factor DROP `status`'); |
|
| 24 | $this->addSql('ALTER TABLE ra_second_factor CHANGE status_int `status` INT NOT NULL'); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function down(Schema $schema) |
|
| 28 | { |
|
| 29 | // this down() migration is auto-generated, please modify it to your needs |
|
| 30 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
| 31 | ||
| 32 | $this->addSql('ALTER TABLE ra_second_factor CHANGE `status` `status` VARCHAR(10) NOT NULL COLLATE utf8_unicode_ci'); |
|
| 33 | ||
| 34 | $this->addSql('ALTER TABLE ra_second_factor ADD status_string VARCHAR(10) NOT NULL COLLATE utf8_unicode_ci'); |
|
| 35 | $this->addSql('UPDATE ra_second_factor SET status_string="unverified" WHERE `status`=0'); |
|
| 36 | $this->addSql('UPDATE ra_second_factor SET status_string="verified" WHERE `status`=10'); |
|
| 37 | $this->addSql('UPDATE ra_second_factor SET status_string="vetted" WHERE `status`=20'); |
|
| 38 | $this->addSql('UPDATE ra_second_factor SET status_string="revoked" WHERE `status`=30'); |
|
| 39 | $this->addSql('ALTER TABLE ra_second_factor DROP `status`'); |
|
| 40 | $this->addSql('ALTER TABLE ra_second_factor CHANGE status_string `status` VARCHAR(10) NOT NULL COLLATE utf8_unicode_ci'); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 11-46 (lines=36) @@ | ||
| 8 | /** |
|
| 9 | * Auto-generated Migration: Please modify to your needs! |
|
| 10 | */ |
|
| 11 | class Version20150611163038 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('ALTER TABLE verified_second_factor DROP FOREIGN KEY fk_verified_second_factor_identity'); |
|
| 22 | $this->addSql('DROP INDEX IDX_7964F91CFF3ED4A8 ON verified_second_factor'); |
|
| 23 | $this->addSql('ALTER TABLE verified_second_factor ADD institution VARCHAR(255) NOT NULL, ADD common_name VARCHAR(255) NOT NULL, CHANGE identity_id identity_id VARCHAR(36) NOT NULL'); |
|
| 24 | $this->addSql('ALTER TABLE vetted_second_factor DROP FOREIGN KEY fk_vetted_second_factor_identity'); |
|
| 25 | $this->addSql('DROP INDEX IDX_29F96B72FF3ED4A8 ON vetted_second_factor'); |
|
| 26 | $this->addSql('ALTER TABLE unverified_second_factor DROP FOREIGN KEY fk_unverified_second_factor_identity'); |
|
| 27 | $this->addSql('DROP INDEX IDX_D79226A2FF3ED4A8 ON unverified_second_factor'); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Schema $schema |
|
| 32 | */ |
|
| 33 | public function down(Schema $schema) |
|
| 34 | { |
|
| 35 | // this down() migration is auto-generated, please modify it to your needs |
|
| 36 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
| 37 | ||
| 38 | $this->addSql('ALTER TABLE unverified_second_factor ADD CONSTRAINT fk_unverified_second_factor_identity FOREIGN KEY (identity_id) REFERENCES identity (id) ON DELETE CASCADE'); |
|
| 39 | $this->addSql('CREATE INDEX IDX_D79226A2FF3ED4A8 ON unverified_second_factor (identity_id)'); |
|
| 40 | $this->addSql('ALTER TABLE verified_second_factor DROP institution, DROP common_name, CHANGE identity_id identity_id VARCHAR(36) DEFAULT NULL COLLATE utf8_unicode_ci'); |
|
| 41 | $this->addSql('ALTER TABLE verified_second_factor ADD CONSTRAINT fk_verified_second_factor_identity FOREIGN KEY (identity_id) REFERENCES identity (id) ON DELETE CASCADE'); |
|
| 42 | $this->addSql('CREATE INDEX IDX_7964F91CFF3ED4A8 ON verified_second_factor (identity_id)'); |
|
| 43 | $this->addSql('ALTER TABLE vetted_second_factor ADD CONSTRAINT fk_vetted_second_factor_identity FOREIGN KEY (identity_id) REFERENCES identity (id) ON DELETE CASCADE'); |
|
| 44 | $this->addSql('CREATE INDEX IDX_29F96B72FF3ED4A8 ON vetted_second_factor (identity_id)'); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||