Answer the question
In order to leave comments, you need to log in
What is the best way to write base-independent migrations?
Actually the question is how best to write migrations? What would they be adaptable to different bases?
Through the Schema class
$this->createTable('{{%someTable}}', [
'id' => Schema::TYPE_PK,
'notes' => Schema::TYPE_TEXT,
], $tableOptions);
$this->createTable('{{%someTable}}', [
'id' => $this->primaryKey(),
'notes' => $this->text(),
], $tableOptions);
Answer the question
In order to leave comments, you need to log in
Are equivalent. Just take a look at the implementation of the methods.
/**
* Creates a boolean column.
* @return ColumnSchemaBuilder the column instance which can be further customized.
* @since 2.0.6
*/
public function boolean()
{
return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BOOLEAN);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question