20250913071830_extension_wuliu_express.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Phinx\Migration\AbstractMigration;
  3. class ExtensionWuliuExpress extends AbstractMigration
  4. {
  5. /**
  6. * Change Method.
  7. *
  8. * Write your reversible migrations using this method.
  9. *
  10. * More information on writing migrations is available here:
  11. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  12. *
  13. * The following commands can be used in this method and Phinx will
  14. * automatically reverse them when rolling back:
  15. *
  16. * createTable
  17. * renameTable
  18. * addColumn
  19. * renameColumn
  20. * addIndex
  21. * addForeignKey
  22. *
  23. * Remember to call "create()" or "update()" and NOT "save()" when working
  24. * with the Table class.
  25. */
  26. public function change()
  27. {
  28. $table = $this->table('extension_wuliu_express');
  29. $table->addColumn('name', Column::STRING, ['limit' => 255, 'comment' => '快递公司名称'])
  30. ->addColumn('code', Column::STRING, ['limit' => 255, 'comment' => '快递公司编码'])
  31. ->addIndex('code', ['unique' => true])
  32. ->create();
  33. }
  34. }