table('mcard_member_card', ['id' => false, 'primary_key' => ['id'], 'comment' => '会员卡定义表']); $table->addColumn('id', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'identity' => true, 'comment' => '主键ID']) ->addColumn('name', 'string', ['limit' => 100, 'null' => false, 'comment' => '会员卡名称']) ->addColumn('description', 'text', ['null' => true, 'comment' => '会员卡描述']) ->addColumn('price', 'decimal', ['precision' => 10, 'scale' => 2, 'null' => false, 'comment' => '会员卡价格']) ->addColumn('validity_period', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'comment' => '有效期(天)']) ->addColumn('sort', 'integer', ['limit' => 11, 'null' => false, 'default' => 0, 'comment' => '排序']) ->addColumn('status', 'integer', ['limit' => 1, 'null' => false, 'default' => 1, 'comment' => '状态:0=禁用,1=启用']) ->addColumn('create_time', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间']) ->addColumn('update_time', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'update' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间']) ->addColumn('delete_time', 'timestamp', ['null' => true, 'comment' => '删除时间']); // 添加索引 $table->addIndex(['status']) ->addIndex(['sort']) ->addIndex(['create_time']); $table->create(); } }