久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='JaVUM'></small><noframes id='JaVUM'>

  • <tfoot id='JaVUM'></tfoot>

      1. <legend id='JaVUM'><style id='JaVUM'><dir id='JaVUM'><q id='JaVUM'></q></dir></style></legend>
      2. <i id='JaVUM'><tr id='JaVUM'><dt id='JaVUM'><q id='JaVUM'><span id='JaVUM'><b id='JaVUM'><form id='JaVUM'><ins id='JaVUM'></ins><ul id='JaVUM'></ul><sub id='JaVUM'></sub></form><legend id='JaVUM'></legend><bdo id='JaVUM'><pre id='JaVUM'><center id='JaVUM'></center></pre></bdo></b><th id='JaVUM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JaVUM'><tfoot id='JaVUM'></tfoot><dl id='JaVUM'><fieldset id='JaVUM'></fieldset></dl></div>
        • <bdo id='JaVUM'></bdo><ul id='JaVUM'></ul>

        如何為 PHP/MySQL 應(yīng)用程序自動遷移(架構(gòu)和數(shù)據(jù))

        How to automate migration (schema and data) for PHP/MySQL application(如何為 PHP/MySQL 應(yīng)用程序自動遷移(架構(gòu)和數(shù)據(jù)))
          <tbody id='CY2oS'></tbody>

            <small id='CY2oS'></small><noframes id='CY2oS'>

            <legend id='CY2oS'><style id='CY2oS'><dir id='CY2oS'><q id='CY2oS'></q></dir></style></legend>
            <tfoot id='CY2oS'></tfoot>
              <bdo id='CY2oS'></bdo><ul id='CY2oS'></ul>

                <i id='CY2oS'><tr id='CY2oS'><dt id='CY2oS'><q id='CY2oS'><span id='CY2oS'><b id='CY2oS'><form id='CY2oS'><ins id='CY2oS'></ins><ul id='CY2oS'></ul><sub id='CY2oS'></sub></form><legend id='CY2oS'></legend><bdo id='CY2oS'><pre id='CY2oS'><center id='CY2oS'></center></pre></bdo></b><th id='CY2oS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CY2oS'><tfoot id='CY2oS'></tfoot><dl id='CY2oS'><fieldset id='CY2oS'></fieldset></dl></div>

                  本文介紹了如何為 PHP/MySQL 應(yīng)用程序自動遷移(架構(gòu)和數(shù)據(jù))的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個 PHP/MySQL 應(yīng)用程序.我正在尋找一種自動方式升級應(yīng)用程序背后的數(shù)據(jù)庫.升級后,我不需要與舊版本兼容.

                  I have an application in PHP/MySQL. I am searching for an automated way upgrading database behind the application. I don't need to have the compatibility with older versions once it is upgraded.

                  我已閱讀 jeff's 和 K.Scott Allen 的 文章.

                  I have read jeff's and K. Scott Allen's articles on this.

                  我仍然不確定如何為 PHP/MySQL 應(yīng)用程序?qū)崿F(xiàn)這一點(diǎn).

                  I am still not sure how to implement this for a PHP/MySQL application.

                  有沒有什么簡單又好的流程呢?

                  Is there any simple and good process for this?

                  推薦答案

                  我有一個我使用的Schema"對象 - 但你可以在沒有類的情況下做同樣的事情..

                  I have a "Schema" object that I use - but you could do the same without classes..

                  您要做的是創(chuàng)建一個db_schema_versions"表:

                  What you want to do is create a 'db_schema_versions' table:

                  CREATE TABLE db_schema_versions (
                    `table` varchar(255) NOT NULL PRIMARY KEY, 
                    `version` INT NOT NULL
                  )
                  

                  在您的數(shù)據(jù)庫可以跟蹤它的版本后#它可以自動進(jìn)行 SQL 升級.

                  After your database can track what version # it is on - it can do SQL upgrades automatically.

                  您應(yīng)該在升級架構(gòu)時鎖定架構(gòu)表.這樣您就不會同時有兩個請求嘗試升級您的架構(gòu).

                  You should lock your schema table while upgrading schema. This way you wont have two requests at the same moment trying to upgrade your schema.

                  所以 - 跟蹤你要升級的版本 - 構(gòu)建一個大開關(guān) - 像這樣:

                  So - keep track of the version you are upgrading from - build a big switch - something like this:

                  class SNTrack_Db_Schema extends MW_Db_Schema_Abstract {
                    protected $table = "sntrack_db_schema";
                    protected $version = 5;
                  
                    protected function upgrade($fromVersion) {
                      // don't break
                      switch($fromVersion) {
                        case 0:
                          $this->db->query('CREATE TABLE sntrack_inbound_shipment (
                              `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
                              `from` VARCHAR(255) NOT NULL,
                              `date` DATE NOT NULL,
                              `invoice` VARCHAR(255) NOT NULL,
                              `notes` TEXT
                            )');
                          $this->setVersion(1);
                        case 1:
                          $this->db->query('ALTER TABLE sntrack_details ADD `shipment_id` INT');
                          $this->db->query('ALTER TABLE sntrack_product ADD `inventory` INT NOT NULL DEFAULT 0');
                          $this->db->query('CREATE TABLE sntrack_inventory_shipment (
                              `shipment_id` INT NOT NULL,
                              `product_id` INT NOT NULL,
                              `qty` INT NOT NULL,
                              PRIMARY KEY (`shipment_id`, `product_id`)
                            )');
                          $this->setVersion(2);
                  ...etc
                  

                  這篇關(guān)于如何為 PHP/MySQL 應(yīng)用程序自動遷移(架構(gòu)和數(shù)據(jù))的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                      <bdo id='gusJd'></bdo><ul id='gusJd'></ul>

                        • <tfoot id='gusJd'></tfoot>

                          <small id='gusJd'></small><noframes id='gusJd'>

                        • <legend id='gusJd'><style id='gusJd'><dir id='gusJd'><q id='gusJd'></q></dir></style></legend>
                            <tbody id='gusJd'></tbody>
                          • <i id='gusJd'><tr id='gusJd'><dt id='gusJd'><q id='gusJd'><span id='gusJd'><b id='gusJd'><form id='gusJd'><ins id='gusJd'></ins><ul id='gusJd'></ul><sub id='gusJd'></sub></form><legend id='gusJd'></legend><bdo id='gusJd'><pre id='gusJd'><center id='gusJd'></center></pre></bdo></b><th id='gusJd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gusJd'><tfoot id='gusJd'></tfoot><dl id='gusJd'><fieldset id='gusJd'></fieldset></dl></div>
                            主站蜘蛛池模板: 请别相信他免费喜剧电影在线观看 | 成人污污视频 | 一区二区三区国产 | 亚洲国产高清在线观看 | 婷婷在线免费 | 国产成人av一区二区三区 | 99久久99久久精品国产片果冰 | 欧美成人hd| 亚洲视频免费在线播放 | 国产亚洲精品久久午夜玫瑰园 | 精品一区二区三区在线视频 | 一级二级三级在线观看 | 一级黄在线观看 | 欧美日韩国产综合在线 | 日韩av成人| 国产精品精品久久久 | 亚洲国产视频一区 | 欧美国产日韩一区二区三区 | 日韩毛片免费看 | 久久久久国产一区二区三区四区 | 欧美午夜视频 | 久久精品亚洲一区二区三区浴池 | 成人精品久久日伦片大全免费 | 天天操,夜夜爽 | 91久久久久 | 精品免费观看 | 国产精品海角社区在线观看 | 黄色大片视频 | 国产欧美精品一区二区三区 | 亚洲视频一区 | 羞羞视频免费观 | 日韩欧美三区 | 色资源站 | 91xxx在线观看 | 拍真实国产伦偷精品 | 一区二区三区四区电影 | 欧美日韩一二三区 | www.婷婷 | 日日日色| 精品一区免费 | 欧美在线一区二区视频 |