<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] > [參考](http://www.hmoore.net/manual/thinkphp6_0/1118028) ## 概述 安裝 ``` composer require topthink/think-migration ``` 初始化文件 AnyClassNameYouWant 為你本次常見的類名 ``` php think migrate:create AnyClassNameYouWant //文件名類似/database/migrations/20190615151716_any_class_name_you_want.php ``` 添加內容 <details> <summary>20190615151716_any_class_name_you_want.php</summary> ``` <?php use think\migration\Migrator; use think\migration\db\Column; class AnyClassNameYouWant extends Migrator { /** * Change Method. * * Write your reversible migrations using this method. * * More information on writing migrations is available here: * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class * * The following commands can be used in this method and Phinx will * automatically reverse them when rolling back: * * createTable * renameTable * addColumn * renameColumn * addIndex * addForeignKey * * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ public function change() { $table = $this->table('user', ['id' => 'user_id','collation'=>'utf8mb4_general_ci']); $table->addColumn('login_name', 'string', ['length' => 50, 'default'=>'', 'comment'=>'賬號']) ->addColumn('user_name', 'string', ['length' => 50, 'default'=>'', 'comment'=>'姓名']) ->addColumn('password', 'string', ['length' => 50, 'default'=>'', 'comment'=>'密碼']) ->addColumn('status', 'integer',['length'=>1,'default'=>1,'comment'=>"狀態;1=正常"]) ->addColumn('email', 'string', ['length' => 50, 'default'=>'', 'comment'=>'郵箱']) ->addColumn('avatar', 'string', ['length' => 100, 'default'=>'', 'comment'=>'頭像']) ->addColumn('sex', 'integer', ['length' => 1, 'default'=>0, 'comment'=>'性別,0=未知,1=男,2=女']) ->addColumn('phone', 'integer', ['length' => 11 , 'default'=>0, 'comment'=>'手機']) ->addColumn('last_login_ip', 'integer',array('limit' => 11,'default'=>0,'comment'=>'最后登錄IP')) ->addColumn('last_login_time', 'datetime',array('default'=>0,'comment'=>'最后登錄時間')) ->addColumn('user_role', 'integer', ['length' => 1 , 'default'=>0, 'comment'=>'系統管理員,0=普通人員,1=超級管理員,2=普通管理員']) ->create(); $user[]=[ "login_name"=>"superadmin", "user_name"=>"超級管理員", "password"=>md5(123456), "user_role"=>1, ]; $user[]=[ "login_name"=>"admin", "user_name"=>"管理員", "password"=>md5(123456), "user_role"=>2, ]; $table->insert($user)->saveData(); } } ``` </details> <br/> 執行 ``` php think migrate:run ``` 添加新的改動: 創建一個新的類名 ``` php think migrate:create AnyClassNameYouWant_new ``` 類文件的change添加變更的操作: 只支持 createTable renameTable addColumn renameColumn addIndex addForeignKey ``` ... public function change() { $table = $this->table('md_user'); $table->addColumn('system_role1', 'integer', ['length' => 1 , 'default'=>0, 'comment'=>'系統管理員,0=普通人員,1=超級管理員,2=普通管理員']) ->save(); } ... ``` 再次執行 ``` php think migrate:run ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看