123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class JjAuthRule extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('jj_auth_rule',array('engine'=>'MyISAM','id'=>true,'comment' => '规则表','primary_key' => ['id']));
- $table->addColumn('name', 'char',array('limit' => 80,'default'=>'','comment'=>'规则唯一标识'))
- ->addColumn('title', 'char',array('limit' => 20,'default'=>'','comment'=>'规则中文名称'))
- ->addColumn('status', 'integer',array('limit' => 1,'default'=>1,'comment'=>'状态:为1正常,为0禁用'))
- ->addColumn('condition', 'char',array('limit' => 100,'default'=>'','comment'=>'规则表达式,为空表示存在就验证,不为空表示按照条件验证'))
- ->addIndex(array('name'), array('unique' => true))
- ->create();
- }
- }
|