20250702093625_hello2.php 963 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use think\migration\Migrator;
  3. class Hello2 extends Migrator
  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_hello');
  29. $table->addColumn('age', 'integer', [
  30. 'limit' => 100,
  31. 'null' => false,
  32. 'comment' => '年龄'
  33. ])->save();
  34. }
  35. }