20220814175532_drop_g_config_table.php 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. final class DropGConfigTable extends AbstractMigration
  5. {
  6. public function up(): void
  7. {
  8. if ($this->hasTable('gconfig')) {
  9. $this->table('gconfig')->drop()->update();
  10. }
  11. }
  12. public function down(): void
  13. {
  14. $this->table('gconfig', [ 'id' => false, 'primary_key' => [ 'id' ]])
  15. ->addColumn('id', 'integer', [ 'identity' => true,'signed' => false ])
  16. ->addColumn('key', 'string', [ 'comment' => '配置键名' ])
  17. ->addColumn('type', 'string', [ 'comment' => '值类型' ])
  18. ->addColumn('value', 'string', [ 'comment' => '配置值' ])
  19. ->addColumn('oldvalue', 'string', [ 'comment' => '之前的配置值' ])
  20. ->addColumn('name', 'string', [ 'comment' => '配置名称' ])
  21. ->addColumn('comment', 'string', [ 'comment' => '配置描述' ])
  22. ->addColumn('operator_id', 'integer', [ 'comment' => '操作员 ID' ])
  23. ->addColumn('operator_name', 'string', [ 'comment' => '操作员名称' ])
  24. ->addColumn('operator_email', 'string', [ 'comment' => '操作员邮箱' ])
  25. ->addColumn('last_update', 'biginteger', [ 'comment' => '修改时间' ])
  26. ->create();
  27. }
  28. }