20220621110250_hydraulic_equipment.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. use Phinx\Db\Adapter\MysqlAdapter;
  5. class HydraulicEquipment extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. $table = $this->table('hydraulic_equipment', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
  31. $table->addColumn('material_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '物料号',])
  32. ->addColumn('equipment_type', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '设备类别',])
  33. ->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '工具名称',])
  34. ->addColumn('equipment_model', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '设备型号',])
  35. ->addColumn('issue_unit', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '发放单位',])
  36. ->addColumn('fixed_asset_number', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '固定资产编号',])
  37. ->addColumn('fixed_asset_number2', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '类固定资产编号',])
  38. ->addColumn('serial_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '序列号',])
  39. ->addColumn('factory_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '出厂编号',])
  40. ->addColumn('check_last_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '上次校验时间',])
  41. ->addColumn('check_next_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '下次校验时间',])
  42. ->addColumn('check_status', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '校验状态',])
  43. ->addColumn('status', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '状态',])
  44. ->addColumn('longitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '经度',])
  45. ->addColumn('latitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '纬度',])
  46. ->addColumn('address', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '地址',])
  47. ->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
  48. ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
  49. ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
  50. ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
  51. ->create();
  52. }
  53. }