<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                運行`migrate:create`命令 如: ~~~ php console migrate:create UpdateBookTable ~~~ 將會創建一個文件名為`YYYYMMDDHHMMSS_update_book_table.php`的文件 前面14位時間戳就是版本號 里面的內容大概是這樣的 ~~~ <?php use Think\Migration\Migration; class UpdateBookTable extends Migration { /** * Change Method. * public function change(){ } */ /** * Migrate Up. */ public function up() { } /** * Migrate Down. */ public function down() { } } ~~~ ### Up 方法 遷移的時候執行的方法 ### Down 方法 回滾的時候執行的方法 ### Change 方法 遷移的時候執行的方法,回滾的時候會逆向執行里面對數據庫結構的操作 比如 ~~~ <?php use Think\Migration\Migration; class CreateUserLoginsTable extends Migration { /** * Change Method. * public function change() { // create the table $table = $this->table('user_logins'); $table->addColumn('user_id', 'integer') ->addColumn('created', 'datetime') ->create(); } /** * Migrate Up. */ public function up() { } /** * Migrate Down. */ public function down() { } } ~~~ > 在`change`方法里創建或者更新數據表結構的時候,必須使用Table的`create()`或者`update()`方法 , 使用`save()`的時候工具不能自動判斷是創建還是更新 #### Table有以下方法 > * createTable > * renameTable > * addColumn > * renameColumn > * addIndex > * addForeignKey ### 直接執行SQL語句 ~~~ <?php use Think\Migration\Migration; class MyNewMigration extends Migration { /** * Migrate Up. */ public function up() { // execute() $count = $this->execute('DELETE FROM users'); // returns the number of affected rows // query() $rows = $this->query('SELECT * FROM users'); // returns the result as an array } /** * Migrate Down. */ public function down() { } } ~~~ ### 獲取數據 ~~~ <?php use Think\Migration\Migration; class MyNewMigration extends Migration { /** * Migrate Up. */ public function up() { // fetch a user $row = $this->fetchRow('SELECT * FROM users'); // fetch an array of messages $rows = $this->fetchAll('SELECT * FROM messages'); } /** * Migrate Down. */ public function down() { } } ~~~
                  <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>

                              哎呀哎呀视频在线观看