Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3系から4系への移行を実装 #39

Merged
merged 6 commits into from
Jun 25, 2020
Merged

3系から4系への移行を実装 #39

merged 6 commits into from
Jun 25, 2020

Conversation

nobuhiko
Copy link
Collaborator

3系から4系への移行

- まだ移行した受注を開けない
 - dtb_tax_rule が異常?
@nobuhiko nobuhiko changed the title [WIP]3to4 3系から4系への移行を実装 Jun 12, 2020
@chihiro-adachi
Copy link
Contributor

以下のデータバックアッププラグインで出力したバックアップファイルを取り込むと、SQLエラーが発生します(PostgreSQL 9.6.17)

EC-CUBE/data-backup-plugin-v3#1

An exception occurred while executing 'INSERT INTO dtb_product_class (id, product_id, sale_type_id, class_category_id1, class_category_id2, delivery_duration_id, creator_id, product_code, stock, stock_unlimited, sale_limit, price01, price02, delivery_fee, visible, create_date, update_date, currency_code, point_rate, discriminator_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);' with params ["0", "1", "1", null, null, null, null, "fork-01", null, "1", null, "115000", "110000", "", 0, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "1", "1", "1", "3", "6", null, null, "fork-01", null, "1", null, "115000", "110000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "2", "1", "1", "3", "5", null, null, "fork-02", null, "1", null, "95000", "93000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "3", "1", "1", "3", "4", null, null, "fork-03", null, "1", null, "75000", "74000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "4", "1", "1", "2", "6", null, null, "fork-04", null, "1", null, "95000", "93000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "5", "1", "1", "2", "5", null, null, "fork-05", null, "1", null, "50000", "49000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "6", "1", "1", "2", "4", null, null, "fork-06", null, "1", null, "35000", "34500", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "7", "1", "1", "1", "6", null, null, "fork-07", null, "1", null, null, "18000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "8", "1", "1", "1", "5", null, null, "fork-08", null, "1", null, null, "13000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "9", "1", "1", "1", "4", null, null, "fork-09", null, "1", null, null, "5000", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass", "10", "2", "1", null, null, null, null, "cafe-01", "100", "0", "5", "3000", "2800", "", 1, "2020-06-10 22:52:26+0000", "2020-06-10 22:52:26+0000", "JPY", null, "productclass"]:

delive_feeが空文字のためエラーになっているようです。

投入したバックアップファイルはこちらです。
backup_20200612150948.tar.gz

postgresの型を考えてどうにか出来ればもっと手っ取り早い気はする
@nanasess
Copy link
Contributor

以下のパッチで、 PostgreSQL9.6 で動作しました

diff --git a/Controller/Admin/ConfigController.php b/Controller/Admin/ConfigController.php
index 1ae1fb7..59e2504 100644
--- a/Controller/Admin/ConfigController.php
+++ b/Controller/Admin/ConfigController.php
@@ -582,6 +582,10 @@ class ConfigController extends AbstractController
                         $value[$column] = ($data['del_flg']) ? 0 : 1;
                     } elseif ($column == 'id' && $tableName == 'dtb_class_name') {
                         $value[$column] = $data['class_id'];
+                    } elseif ($column == 'id' && $tableName == 'dtb_product_stock') {
+                        $value[$column] = $data['product_stock_id'];
+                    } elseif ($column == 'id' && $tableName == 'dtb_product_image') {
+                        $value[$column] = $data['product_image_id'];
 
                     // 共通処理
                     } elseif ($column == 'discriminator_type') {
@@ -1207,7 +1211,14 @@ class ConfigController extends AbstractController
                     } elseif ($column == 'delivery_id') {
                         $value[$column] = isset($data['deliv_id']) ? $data['deliv_id'] : null;
                     } elseif ($column == 'delivery_time') {
-                        $value[$column] = isset($data['deliv_time']) ? $data['deliv_time'] : null;
+                        if (isset($data['deliv_time'])) {
+                            $value[$column] = $data['deliv_time'];
+                        } elseif (isset($data['delivery_time'])) {
+                            $value[$column] = $data['delivery_time'];
+                        } else {
+                            $value[$column] = null;
+                        }
+
                     } elseif ($column == 'fee') {
                         $value[$column] = !empty($data['fee']) ? $data['fee'] : 0;
                     // --> payment

PHP7.4対応(see: EC-CUBE/ec-cube@6931f30)

diff --git a/Form/Type/Admin/ConfigType.php b/Form/Type/Admin/ConfigType.php
index 6f90410..a9df001 100644
--- a/Form/Type/Admin/ConfigType.php
+++ b/Form/Type/Admin/ConfigType.php
@@ -24,7 +24,7 @@ class ConfigType extends AbstractType
                 'constraints' => [
                     new NotBlank(['message' => 'ファイルを選択してください。']),
                     new File([
-                        'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip'],
+                        'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip', 'application/gzip'],
                         'mimeTypesMessage' => 'zipファイル、tarファイル、tar.gzファイルのいずれかをアップロードしてください。',
                     ]),
                 ],

@nanasess
Copy link
Contributor

会員と受注データのみ移行する にチェックを入れると、以下のシステムエラーが発生する場合があります。

[2020-06-16 10:01:32] admin.ERROR [21a43ea9] [80dfac5] [2] [Eccube\Log\Logger:log:64] - システムエラーが発生しました。 ["Notice: Undefined offset: 1","/path/to/ec-cube/app/Plugin/DataMigration4/Controller/Admin/ConfigController.php",1317,"#0 /path/to/ec-cube/app/Plugin/DataMigration4/Controller/Admin/ConfigController.php(165): Plugin\\DataMigration4\\Controller\\Admin\\ConfigController->saveToO(Object(Doctrine\\DBAL\\Connection), '/Users/nanasess...', 'dtb_shipping')\n#1 /path/to/ec-cube/app/Plugin/DataMigration4/Controller/Admin/ConfigController.php(121): Plugin\\DataMigration4\\Controller\\Admin\\ConfigController->saveCustomerAndOrder(Object(Doctrine\\DBAL\\Connection), '/Users/nanasess...')\n#2 /path/to/ec-cube/vendor/symfony/http-kernel/HttpKernel.php(151): Plugin\\DataMigration4\\Controller\\Admin\\ConfigController->index(Object(Symfony\\Component\\HttpFoundation\\Request), Object(Doctrine\\DBAL\\Connection))\n#3 /path/to/ec-cube/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#4 /path/to/ec-cube/vendor/symfony/http-kernel/Kernel.php(200): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#5 /path/to/ec-cube/index.php(76): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#6 {main}"] [POST, /manager/data_migration4/config, 127.0.0.1, https://127.0.0.1:8000/manager/data_migration4/config, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15]

dtb_shipping の前に dtb_delivery_time を設定しておく必要がありそうです

diff --git a/Controller/Admin/ConfigController.php b/Controller/Admin/ConfigController.php
index 1ae1fb7..f726c0c 100644
--- a/Controller/Admin/ConfigController.php
+++ b/Controller/Admin/ConfigController.php
@@ -156,6 +156,7 @@ class ConfigController extends AbstractController
 
         if ($this->flag_3) {
             $this->saveToC($em, $csvDir, 'dtb_customer_address');
+            $this->saveToO($em, $csvDir, 'dtb_delivery_time');
         } else {
             $this->saveToC($em, $csvDir, 'dtb_other_deliv', 'dtb_customer_address', false, 1/*$index*/);
         }

@okazy okazy added the enhancement New feature or request label Jun 23, 2020
@okazy okazy added this to the 1.x milestone Jun 23, 2020
@chihiro-adachi chihiro-adachi merged commit 50efb05 into master Jun 25, 2020
@chihiro-adachi
Copy link
Contributor

ありがとうございます。マージしました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants