yii - Create a column with primary key using migrations -


i using migrations in yii create new column with. code works fine however, unsure how set primary key?

this part migration file:

public function up() {     $this->addcolumn(         'competition_prizes',         'prize_id',         'int(11) unsigned not null first',     );      $this->addprimarykey('pk1', 'competition_prizes', 'prize_id'); } 

i don't know, how make competition_prizes column primary key.

after addcolumn function add line

$this->addprimarykey('pk1', 'competition_prizes', 'prize_id') 

make sure there no primary key column in table.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -