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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -