abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql('ALTER TABLE subscription CHANGE plan_id plan_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D3E899029B FOREIGN KEY (plan_id) REFERENCES plan (id)'); $this->addSql('CREATE INDEX IDX_A3C664D3E899029B ON subscription (plan_id)'); $this->addSql('ALTER TABLE notifications CHANGE timezone timezone VARCHAR(255) NOT NULL, CHANGE notification_type notification_type VARCHAR(255) NOT NULL, CHANGE theme_type theme_type VARCHAR(255) NOT NULL'); } /** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql('ALTER TABLE notifications CHANGE notification_type notification_type VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE theme_type theme_type VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE timezone timezone VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci'); $this->addSql('ALTER TABLE subscription DROP FOREIGN KEY FK_A3C664D3E899029B'); $this->addSql('DROP INDEX IDX_A3C664D3E899029B ON subscription'); $this->addSql('ALTER TABLE subscription CHANGE plan_id plan_id INT NOT NULL'); } }