Answer the question
In order to leave comments, you need to log in
How to set primary key name via Yii2 migration?
There is an iis server
There is php7.1
There is a sqlsrv extension for mssql By default
I write migration like this
$this->createTable('tableName', [
'id' => $this->primaryKey(10)->unsigned(),
...
]
Answer the question
In order to leave comments, you need to log in
it is easier to create a similar key through
['id' => Schema::TYPE_UPK]
dropTable('tableName')
PRIMARY KEY (`id`)
SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA . KEY_COLUMN_USAGE where CONSTRAINT_SCHEMA='db_name' AND TABLE_NAME='table_name' AND CONSTRAINT_NAME="PRIMARY"
$this->db->createCommand($sql = null, $params = [])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question