From 17f038196c0238f7f72f4a0c3a96546723342b76 Mon Sep 17 00:00:00 2001 From: PoulainMaxime Date: Wed, 26 Feb 2025 10:55:25 +0100 Subject: [PATCH 1/4] feat: add new shipment table --- upgrade/sql/9.0.1.sql | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 upgrade/sql/9.0.1.sql diff --git a/upgrade/sql/9.0.1.sql b/upgrade/sql/9.0.1.sql new file mode 100644 index 000000000..d8d19a4c9 --- /dev/null +++ b/upgrade/sql/9.0.1.sql @@ -0,0 +1,31 @@ +SET + SESSION sql_mode = ''; + +SET + NAMES 'utf8mb4'; + +/* Insert new shipment table */ +/* https://github.com/PrestaShop/PrestaShop/pull/38046 */ +CREATE TABLE IF NOT EXISTS `PREFIX_shipment` ( + `id_shipment` int(10) AUTO_INCREMENT NOT NULL, + `id_order` int(10) NOT NULL, + `id_carrier` int(10) NOT NULL, + `id_delivery_address` int(10) DEFAULT NULL, + `shipping_cost_tax_excl` NUMERIC(20, 6) DEFAULT '0.000000', + `shipping_cost_tax_incl` NUMERIC(20, 6) DEFAULT '0.000000', + `packed_at` datetime DEFAULT NULL, + `shipped_at` datetime DEFAULT NULL, + `delivered_at` datetime DEFAULT NULL, + `tracking_number` varchar(255) DEFAULT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id_shipment`), +) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4 COLLATION; + +CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( + `shipment_product_id` int(10) NOT NULL, + `shipment_id` int(10) NOT NULL, + `order_detail_id` int(10) NOT NULL, + `quantity` int(10) DEFAULT NULL, + PRIMARY KEY (shipment_id), +) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4 COLLATION; From 643e94bfe3639de33b3740ef79efe38317363c9e Mon Sep 17 00:00:00 2001 From: PoulainMaxime Date: Wed, 26 Feb 2025 10:58:44 +0100 Subject: [PATCH 2/4] feat: modify charset --- upgrade/sql/9.0.1.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upgrade/sql/9.0.1.sql b/upgrade/sql/9.0.1.sql index d8d19a4c9..57b39dd7a 100644 --- a/upgrade/sql/9.0.1.sql +++ b/upgrade/sql/9.0.1.sql @@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_shipment` ( `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id_shipment`), -) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4 COLLATION; +) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4; CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( `shipment_product_id` int(10) NOT NULL, @@ -28,4 +28,4 @@ CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( `order_detail_id` int(10) NOT NULL, `quantity` int(10) DEFAULT NULL, PRIMARY KEY (shipment_id), -) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4 COLLATION; +) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4; From 7cf54f1111ea30c361e038ad4f73335b0d6af3c7 Mon Sep 17 00:00:00 2001 From: PoulainMaxime Date: Wed, 26 Feb 2025 11:01:11 +0100 Subject: [PATCH 3/4] feat: change ps version --- upgrade/sql/9.0.1.sql | 31 ------------------------------- upgrade/sql/9.1.0.sql | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 31 deletions(-) delete mode 100644 upgrade/sql/9.0.1.sql diff --git a/upgrade/sql/9.0.1.sql b/upgrade/sql/9.0.1.sql deleted file mode 100644 index 57b39dd7a..000000000 --- a/upgrade/sql/9.0.1.sql +++ /dev/null @@ -1,31 +0,0 @@ -SET - SESSION sql_mode = ''; - -SET - NAMES 'utf8mb4'; - -/* Insert new shipment table */ -/* https://github.com/PrestaShop/PrestaShop/pull/38046 */ -CREATE TABLE IF NOT EXISTS `PREFIX_shipment` ( - `id_shipment` int(10) AUTO_INCREMENT NOT NULL, - `id_order` int(10) NOT NULL, - `id_carrier` int(10) NOT NULL, - `id_delivery_address` int(10) DEFAULT NULL, - `shipping_cost_tax_excl` NUMERIC(20, 6) DEFAULT '0.000000', - `shipping_cost_tax_incl` NUMERIC(20, 6) DEFAULT '0.000000', - `packed_at` datetime DEFAULT NULL, - `shipped_at` datetime DEFAULT NULL, - `delivered_at` datetime DEFAULT NULL, - `tracking_number` varchar(255) DEFAULT NULL, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - PRIMARY KEY (`id_shipment`), -) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4; - -CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( - `shipment_product_id` int(10) NOT NULL, - `shipment_id` int(10) NOT NULL, - `order_detail_id` int(10) NOT NULL, - `quantity` int(10) DEFAULT NULL, - PRIMARY KEY (shipment_id), -) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4; diff --git a/upgrade/sql/9.1.0.sql b/upgrade/sql/9.1.0.sql index 44c2aa568..72646948a 100644 --- a/upgrade/sql/9.1.0.sql +++ b/upgrade/sql/9.1.0.sql @@ -5,3 +5,29 @@ SET NAMES 'utf8mb4'; /* https://github.com/PrestaShop/PrestaShop/pull/38040 */ INSERT INTO `PREFIX_feature_flag` (`name`, `type`, `label_wording`, `label_domain`, `description_wording`, `description_domain`, `state`, `stability`) VALUES ('improved_shipment', 'env,dotenv,db', 'Improved shipment', 'Admin.Advparameters.Feature', 'Enable / Disable the newly improved shipment system', 'Admin.Advparameters.Help', 0, 'beta'); + +/* Insert new shipment table */ +/* https://github.com/PrestaShop/PrestaShop/pull/38046 */ +CREATE TABLE IF NOT EXISTS `PREFIX_shipment` ( + `id_shipment` int(10) AUTO_INCREMENT NOT NULL, + `id_order` int(10) NOT NULL, + `id_carrier` int(10) NOT NULL, + `id_delivery_address` int(10) DEFAULT NULL, + `shipping_cost_tax_excl` NUMERIC(20, 6) DEFAULT '0.000000', + `shipping_cost_tax_incl` NUMERIC(20, 6) DEFAULT '0.000000', + `packed_at` datetime DEFAULT NULL, + `shipped_at` datetime DEFAULT NULL, + `delivered_at` datetime DEFAULT NULL, + `tracking_number` varchar(255) DEFAULT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id_shipment`), +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( + `shipment_product_id` int(10) NOT NULL, + `shipment_id` int(10) NOT NULL, + `order_detail_id` int(10) NOT NULL, + `quantity` int(10) DEFAULT NULL, + PRIMARY KEY (shipment_id), +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4; From 4c41148417dfcdbb538dfc2185193962cb44f7af Mon Sep 17 00:00:00 2001 From: PoulainMaxime Date: Fri, 28 Feb 2025 16:08:22 +0100 Subject: [PATCH 4/4] fix: change properties --- upgrade/sql/9.1.0.sql | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/upgrade/sql/9.1.0.sql b/upgrade/sql/9.1.0.sql index 72646948a..271dd6188 100644 --- a/upgrade/sql/9.1.0.sql +++ b/upgrade/sql/9.1.0.sql @@ -9,25 +9,26 @@ INSERT INTO `PREFIX_feature_flag` (`name`, `type`, `label_wording`, `label_domai /* Insert new shipment table */ /* https://github.com/PrestaShop/PrestaShop/pull/38046 */ CREATE TABLE IF NOT EXISTS `PREFIX_shipment` ( - `id_shipment` int(10) AUTO_INCREMENT NOT NULL, - `id_order` int(10) NOT NULL, - `id_carrier` int(10) NOT NULL, - `id_delivery_address` int(10) DEFAULT NULL, - `shipping_cost_tax_excl` NUMERIC(20, 6) DEFAULT '0.000000', - `shipping_cost_tax_incl` NUMERIC(20, 6) DEFAULT '0.000000', - `packed_at` datetime DEFAULT NULL, - `shipped_at` datetime DEFAULT NULL, - `delivered_at` datetime DEFAULT NULL, - `tracking_number` varchar(255) DEFAULT NULL, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - PRIMARY KEY (`id_shipment`), -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4; + `id_shipment` int(10) AUTO_INCREMENT NOT NULL, + `id_order` int(10) NOT NULL, + `id_carrier` int(10) NOT NULL, + `id_delivery_address` int(10) DEFAULT NULL, + `shipping_cost_tax_excl` NUMERIC(20, 6) DEFAULT '0.000000', + `shipping_cost_tax_incl` NUMERIC(20, 6) DEFAULT '0.000000', + `packed_at` datetime DEFAULT NULL, + `shipped_at` datetime DEFAULT NULL, + `delivered_at` datetime DEFAULT NULL, + `cancelled_at` DATETIME DEFAULT NULL, + `tracking_number` varchar(255) DEFAULT NULL, + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_shipment`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4 COLLATION; CREATE TABLE IF NOT EXISTS `PREFIX_shipment_product` ( - `shipment_product_id` int(10) NOT NULL, - `shipment_id` int(10) NOT NULL, - `order_detail_id` int(10) NOT NULL, - `quantity` int(10) DEFAULT NULL, - PRIMARY KEY (shipment_id), -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4; + `id_shipment_product` INT AUTO_INCREMENT NOT NULL, + `id_shipment` int(10) NOT NULL, + `id_order_detail` int(10) NOT NULL, + `quantity` int(10) DEFAULT NULL, + PRIMARY KEY (id_shipment_product) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4 COLLATION;