webman 数据库迁移(phinx和migrate)可自选

v0.0.6 版本
2025-01-08 版本更新时间
13 安装
1 star

简介

基于webman/console实现phinx和laravel的migrations命令

安装

composer require x2nx/webman-migrate

使用

  • 配置文件所在位置:config/plugin/x2nx/webman-migrate/app.php
    <?php
    return [
    'enable' => true,
    'driver' => 'migrate'//
    ];
  • 配置说明
    driver=phinx 则集成phinx的console
    driver=migrate 则集成larvel的migrate

效果图

  • migrate 模式
~/webman # ./webman
webman cli

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  completion             Dump the shell completion script
  connections            Get worker connections.
  db                     Start a new database CLI session
  fix-disable-functions  Fix disbale_functions in php.ini
  help                   Display help for a command
  install                Execute webman installation script
  list                   List commands
  migrate                Migrate the database
  reload                 Reload codes. Use mode -g to reload gracefully.
  restart                Restart workers. Use mode -d to start in DAEMON mode. Use mode -g to stop gracefully.
  start                  Start worker in DEBUG mode. Use mode -d to start in DAEMON mode.
  status                 Get worker status. Use mode -d to show live status.
  stop                   Stop worker. Use mode -g to stop gracefully.
  version                Show webman version
 app-plugin
  app-plugin:create      App Plugin Create
  app-plugin:install     App Plugin Install
  app-plugin:uninstall   App Plugin Uninstall
  app-plugin:update      App Plugin Update
  app-plugin:zip         App Plugin Zip
 build
  build:bin              build bin
  build:phar             [phar:pack] Can be easily packaged a project into phar files. Easy to distribute and use.
 db
  db:monitor             Monitor the number of connections on the specified database
  db:seed                Seed the database with records
  db:show                Display information about the given database
  db:table               Display information about the given database table
 make
  make:bootstrap         Make bootstrap
  make:command           Make command
  make:controller        Make controller
  make:factory           Create a new model factory
  make:middleware        Make middleware
  make:migration         Create a new migration file
  make:model             Make model
  make:seeder            Create a new seeder class
 migrate
  migrate:fresh          Drop all tables and re-run all migrations
  migrate:install        Create the migration repository
  migrate:refresh        Reset and re-run all migrations
  migrate:reset          Rollback all database migrations
  migrate:rollback       Rollback the last database migration
  migrate:status         Show the status of each migration
 model
  model:prune            Prune models that are no longer needed
  model:show             Show information about an Eloquent model
 plugin
  plugin:create          Plugin create
  plugin:disable         Disable plugin by name
  plugin:enable          Enable plugin by name
  plugin:export          Plugin export
  plugin:install         Execute plugin installation script
  plugin:uninstall       Execute plugin uninstall script
 route
  route:list             Route list
 schema
  schema:dump            Dump the given database schema
  • phinx 模式
~/webman # ./webman 
webman cli

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  completion             Dump the shell completion script
  connections            Get worker connections.
  fix-disable-functions  Fix disbale_functions in php.ini
  help                   Display help for a command
  install                Execute webman installation script
  list                   List commands
  migrate                Migrate the database
  reload                 Reload codes. Use mode -g to reload gracefully.
  restart                Restart workers. Use mode -d to start in DAEMON mode. Use mode -g to stop gracefully.
  start                  Start worker in DEBUG mode. Use mode -d to start in DAEMON mode.
  status                 Get worker status. Use mode -d to show live status.
  stop                   Stop worker. Use mode -g to stop gracefully.
  version                Show webman version
 app-plugin
  app-plugin:create      App Plugin Create
  app-plugin:install     App Plugin Install
  app-plugin:uninstall   App Plugin Uninstall
  app-plugin:update      App Plugin Update
  app-plugin:zip         App Plugin Zip
 build
  build:bin              build bin
  build:phar             [phar:pack] Can be easily packaged a project into phar files. Easy to distribute and use.
 make
  make:bootstrap         Make bootstrap
  make:command           Make command
  make:controller        Make controller
  make:middleware        Make middleware
  make:model             Make model
 migrate
  migrate:breakpoint     Manage breakpoints
  migrate:create         Create a new migration
  migrate:init           Initialize the application for Phinx
  migrate:list:aliases   List template class aliases
  migrate:rollback       Rollback the last or to a specific migration
  migrate:status         Show migration status
  migrate:test           Verify the configuration file
 plugin
  plugin:create          Plugin create
  plugin:disable         Disable plugin by name
  plugin:enable          Enable plugin by name
  plugin:export          Plugin export
  plugin:install         Execute plugin installation script
  plugin:uninstall       Execute plugin uninstall script
 route
  route:list             Route list
 seed
  seed:create            Create a new database seeder
  seed:run               Run database seeders
赞助商