problems in database migration

hello friends.I am newbie to Yii.I have a database in Mysql and now I want to migrate it.So my mysql database is like this


CREATE TABLE IF NOT EXISTS `ntm_attachments` (

  `id` bigint(20) NOT NULL AUTO_INCREMENT,

  `owner_id` bigint(20) NOT NULL,

  `item_id` bigint(20) NOT NULL,

  `name` varchar(150) NOT NULL,

  `description` text NOT NULL,

  `file` varchar(255) NOT NULL,

  `file_ufilename` varchar(255) NOT NULL,

  `type` enum('photo','attachment','gallery') NOT NULL,

  `is_primary` tinyint(1) NOT NULL DEFAULT '0',

  `created_at` datetime NOT NULL,

  `updated_at` datetime NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=36 ;

So for doing migration I used the code




<?php

class m110503_174050_ntm_attachments extends CDbMigration

{

    public function up()

    {

      $this -> createTable ('ntm_attachments', array(

      'id' => 'pk',

      'owner_id' => 'bigint NOT NULL',

      'content' => 'text',

      'item_id' => 'bigint NOT NULL',

      'name' => 'varchar NOT NULL',

      'description'=> 'text NOT NULL',

      'file' =>'varchar NOT NULL',

      'file_ufilename' =>'varchar  NOT NULL',

      'type' => 'enum('photo','attachment','gallery') NOT NULL',  

      'is_primary' => 'tinyint NOT NULL DEFAULT \'0\' ',

      'created_at' => 'datetime NOT NULL',

      'updated_at'=> 'datetime NOT NULL'

      ))

    }

    public function down()

    {

       $this->dropTable('ntm_attachments');

    }


}

?>



So I think there is some problem in this.Can any one tell me where is the problem and how to write this code?

just check this line.I think this is not right.


 'type' => 'enum('photo','attachment','gallery') NOT NULL', 

Escape ’ with \.

You May use double quote inside single quote


 'type' => 'enum("photo","attachment","gallery") NOT NULL', 

Or

Escape ’ with \