Yii Migrations Issue With Auto Increment

I am trying to make a new column on a table that will be the primary key and also be created with an auto increment.

Nothing I try seems to work - can anyone assist me in this?




	public function up()

	{

		$this->addColumn(

			'competition_prizes',

			'prize_id',

			'INT(11) UNSIGNED NOT NULL FIRST AUTO_INCREMENT'

		);


		$this->createIndex('prize_id', 'competition_prizes', 'prize_id', TRUE);

		$this->addPrimaryKey('PK', 'competition_prizes', 'prize_id');

	}



I get the following error : there can be only one auto column and it must be defined as a key

Try:




        public function up()

        {

                $this->addColumn(

                        'competition_prizes',

                        'prize_id',

                        'INT(11) UNSIGNED NOT NULL FIRST AUTO_INCREMENT PRIMARY KEY'

                );

        }



Awesome Kev! :) Thanks, great forum :)