12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- use think\migration\Migrator;
- class CreateCustomerSharingTable 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('customer_sharing', ['id' => false, 'primary_key' => ['customer_id', 'employee_id']]);
- $table->addColumn('customer_id', 'integer', ['comment' => '客户id'])
- ->addColumn('employee_id', 'integer', ['comment' => '员工id'])
- ->addColumn('root_id', 'integer', ['comment' => '所属企业id'])
- ->addColumn('addtime', 'integer', ['comment' => '添加时间'])
- ->create();
- }
- }
|