1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateEmployeeMedal 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()
- {
- $this->table('employee_medal', ['comment' => '员工勋章'])
- ->addColumn('root_id', 'integer', ['comment' => '店面id', 'null' => true,'default'=>0])
- ->addColumn('employee_id', 'integer', ['comment' => '员工id','null' => true,'default'=>0])
- ->addColumn('medal_id', 'integer', ['comment' => '勋章id','null' => true,'default'=>0])
- ->addColumn('main', 'integer', ['comment' => '是否佩戴','null' => true,'default'=>0])
- ->addColumn('type', 'string', ['limit'=> 255, 'comment'=> '类型', 'default'=> '','null' => true])
- ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP','null' => true])
- ->create();
- $this->table('medal', ['comment' => '勋章体系'])
- ->addColumn('title', 'string', ['limit'=> 255, 'comment'=> '勋章标题', 'default'=> '','null' => true])
- ->addColumn('content', 'string', ['limit'=> 255, 'comment'=> '内容', 'default'=> '','null' => true])
- ->addColumn('type', 'string', ['limit'=> 255, 'comment'=> '类型', 'default'=> '','null' => true])
- ->addColumn('condition', 'integer', ['comment' => '达成条件','null' => true,'default'=>0])
- ->addColumn('remark', 'string', ['limit'=> 255, 'comment'=> '备注', 'default'=> '','null' => true])
- ->addColumn('path', 'string', ['limit'=> 255, 'comment'=> 'logo路径', 'default'=> '','null' => true])
- ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP','null' => true])
- ->create();
- }
- }
|