2016-05-12 19:16:04 2440次浏览 1条回答 0 悬赏 10 金钱
`status` enum('active','blocked') NOT NULL DEFAULT 'active' COMMENT '状态',

在migration中应该怎么写才能创建枚举类型?

'status' => $this->smallInteger()->notNull()->defaultValue(10),
  • 回答于 2016-05-13 09:16 举报

    现执行创建表,然后使用 addColumn方法添加字段

    // $this->createTable....
    $this->addColumn("{{%test}}", "status", "ENUM('1', '2', '3', '4', '10') NOT NULL DEFAULT '10' COMMENT '状态'");
    
您需要登录后才可以回答。登录 | 立即注册
fanfan
职场新人

fanfan

注册时间:2016-04-27
最后登录:2016-06-01
在线时长:1小时11分
  • 粉丝1
  • 金钱45
  • 威望0
  • 积分55

热门问题