/** * remove table. * * @param Schema $schema */ public function down(Schema $schema) { //current version >= 3.0.9 if (Version::isSupportGetInstanceFunction()) { $app = Application::getInstance(); $meta = $this->getMetadata($app['orm.em']); $tool = new SchemaTool($app['orm.em']); $schemaFromMetadata = $tool->getSchemaFromMetadata($meta); // テーブル削除 foreach ($schemaFromMetadata->getTables() as $table) { if ($schema->hasTable($table->getName())) { $schema->dropTable($table->getName()); } } // シーケンス削除 foreach ($schemaFromMetadata->getSequences() as $sequence) { if ($schema->hasSequence($sequence->getName())) { $schema->dropSequence($sequence->getName()); } } //for delete sequence in postgresql if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') { $schema->dropSequence('plg_related_product_id_seq'); } } else { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable(self::NAME); $schema->dropSequence('plg_related_product_id_seq'); } }
/** * Remove data. * * @param Schema $schema */ public function down(Schema $schema) { if (Version::isSupportGetInstanceFunction()) { $app = Application::getInstance(); $meta = $this->getMetadata($app['orm.em']); $tool = new SchemaTool($app['orm.em']); $schemaFromMetadata = $tool->getSchemaFromMetadata($meta); // テーブル削除 foreach ($schemaFromMetadata->getTables() as $table) { if ($schema->hasTable($table->getName())) { $schema->dropTable($table->getName()); } } // シーケンス削除 foreach ($schemaFromMetadata->getSequences() as $sequence) { if ($schema->hasSequence($sequence->getName())) { $schema->dropSequence($sequence->getName()); } } } else { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable(self::NAME); $schema->dropSequence('plg_recommend_product_recommend_product_id_seq'); } }
/** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable('plg_coupon'); $schema->dropSequence('plg_coupon_coupon_id_seq'); $schema->dropTable('plg_coupon_detail'); $schema->dropSequence('plg_coupon_detail_coupon_detail_id_seq'); $schema->dropTable('plg_coupon_order'); $schema->dropSequence('plg_coupon_order_id_seq'); }
/** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable('plg_mailmaga_plugin'); // drop Sequence MailMagazine Plug-in $schema->dropTable('plg_mailmaga_template'); $schema->dropTable('plg_send_history'); $schema->dropTable('plg_send_customer'); // drop sequence. $schema->dropSequence('plg_mailmaga_template_template_id_seq'); $schema->dropSequence('plg_send_history_send_id_seq'); }
/** * Down method * * @param Schema $schema */ public function down(Schema $schema) { if (Version::isSupportGetInstanceFunction()) { $app = Application::getInstance(); $meta = $this->getMetadata($app['orm.em']); $tool = new SchemaTool($app['orm.em']); $schemaFromMetadata = $tool->getSchemaFromMetadata($meta); // テーブル削除 foreach ($schemaFromMetadata->getTables() as $table) { if ($schema->hasTable($table->getName())) { $schema->dropTable($table->getName()); } } // シーケンス削除 foreach ($schemaFromMetadata->getSequences() as $sequence) { if ($schema->hasSequence($sequence->getName())) { $schema->dropSequence($sequence->getName()); } } } else { if ($schema->hasTable(self::MAKER)) { $schema->dropTable(self::MAKER); } if ($schema->hasTable(self::PRODUCTMAKER)) { $schema->dropTable(self::PRODUCTMAKER); } } if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') { foreach ($this->sequence as $sequence) { if ($schema->hasSequence($sequence)) { $schema->dropSequence($sequence); } } } }
/** * @param Schema $schema */ public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs $this->addSql("alter table plg_coupon_order add user_id integer"); $this->addSql("alter table plg_coupon_order add email text"); $this->addSql("alter table plg_coupon_order add discount decimal not null default 0"); $this->addSql("alter table plg_coupon add coupon_use_time integer"); if ($schema->hasTable('plg_coupon_plugin')) { $schema->dropTable('plg_coupon_plugin'); $schema->dropSequence('plg_coupon_plugin_plugin_id_seq'); } }
/** * @param Schema $schema */ public function up(Schema $schema) { foreach ($this->targetTables as $table) { if ($schema->hasTable($table)) { $schema->dropTable($table); } } if ($this->connection->getDatabasePlatform()->getName() == "postgresql") { foreach ($this->targetSequences as $seq) { if ($schema->hasSequence($seq)) { $schema->dropSequence($seq); } } } }
public function testDropSequence() { $sequence = new Sequence("a_seq", 1, 1); $schema = new Schema(array(), array($sequence)); $schema->dropSequence("a_seq"); $this->assertFalse($schema->hasSequence("a_seq")); }
/** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable('plg_recommend_product'); $schema->dropSequence('plg_recommend_product_recommend_product_id_seq'); }
/** * {@inheritdoc} */ public function acceptSequence(Sequence $sequence) { if (!$sequence->isInDefaultNamespace($this->schema->getName())) { $this->schema->dropSequence($sequence->getName()); } }
/** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable('plg_order_pdf_plugin'); $schema->dropSequence('plg_order_pdf_plugin_plugin_id_seq'); }
/** * @param Schema $schema */ public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $schema->dropTable('plg_mailmaga_customer'); $schema->dropSequence('plg_mailmaga_customer_id_seq'); }