Poniżej sposób na uzupełnienie sklepu podczas jego akutalizacji. Scenariusz tutaj opisany przewiduje, że sklep w dalszym ciągu funkcjonuje natomiast my wykonujemy jego aktualizację „na boku” (na innym serwerze, niewidocznym przez klienta). Z tego wynika problem pojawiających się nowych zamówień, rejestracji, wiadomości od klienta. Jeśli np. po miesiącu wgramy nowy sklep – w bazie danych powstanie „dziura”. Przez to baza będzie niespójna, a u klientów może wywołać to niepokój, że np. historia ich zamówień jest niepełna.
Poniżej sposób jak uzupełnić te dane wręcz kilkoma zapytaniami do SQL.
Uwaga! Manipulacja w bazie danych może przyczynić się do uszkodzenia Twojego sklepu! Najlepiej wykonaj uprzednio kopię bezpieczeństwa bazy danych, albo zleć te prace specjalistom [kryptoreklama 😉 ]:
Zawartość artykułu
Przygotowanie bazy danych
Zakładamy, że:
-
- wersja sklepu to 1.7 (dokładniej 1.7.8.3). Jednak w nowszych też to powinno zadziałać. Uzupełniamy kluczowe tabele w sklepie, które nie powinny się dużo zmienić w nowszych wydaniach PrestaShop
- Tabele (odnawianego) sklepu posiadają prefix „ps_” natomiast tabele starego sklepu, gdzie powstają nowe rejestracje, zamówienia „px_”. Po prostu tabele z obu sklepów należy wgrać do tej samej bazy danych.
- Struktura tabel jest identyczna. Tj kolejność kolumn, liczba kolumn, typy kolumn. Można to łatwo skorygować poprzez PhpMyAdmin. Warto tutaj zaznaczyć, że zmieniamy tabele z prefixem px_. Jak to dokładnie zrobić opisaliśmy tutaj wraz ze screenami: https://pskrk.com/aktualizacja-prestashop-do-1-7-dane-starego-sklepu-w-zupelnie-czystej-instalacji-ps17/#Import_koszykow Dodatkowo w dalszej części artykułu jest podane przykładowe zapytanie, które odpowiednio poprawi tabele z prefixem px_.
- nie uwzględniamy tutaj specyficznego zarządzania magazynem czy rotacji produtków. Nie bierzemy też pod uwagę zmiany asortymentu sklepu. czyli pojawienia się nowych produktów, ich usunięcie; dodanie nowych kategorii itp. Interesują nas jedynie nowe zamówienia, rejestracje klientów, wiadomości od nich, pełna historia zamówień. Tak, aby np. klient po zalogowaniu do nowego sklepu nie „odczuł”, że są braki w zamówieniach na jego koncie.
Tutaj uwaga co do „poprawiania tabel” z ww. linku. Nowe kolumny należy dodać z wartością NULL ustawioną na TAK. Potem zostanie to skorygowane.
Komenda SSH (konsola Linux) do zamiany prefixu w pliku SQL
Jeśli posiadasz dostęp do terminalu Linux – linia komend SSH (niektórzy hostingodawcy udostępniają takie narzędzie, także wirtualne) wystarczy prosta komenda która w pliku SQL szybko zamieni ww. prefix ps_ na px_
Wystarczy, że wywołasz:
sed -ie 's/`ps\_/`px_/g' dump.sql
Musisz wywołać to w tym samym folderze, gdzie znajduje się plik zrzutu bazy SQL. Oczywiście zostanie od bezpowrotnie zmieniony i w razie potrzeby wykonaj jego kopię bezpieczeństwa.
Następnie taki plik SQL wystarczy wgrać do bazy MySQL sklepu.
Zapytania kopiujące dane
Na początek wykonaj zapytanie:
INSERT INTO ps_address SELECT * FROM px_address WHERE id_address > (select max(id_address) from ps_address); INSERT INTO ps_cart SELECT * FROM px_cart WHERE id_cart > (select max(id_cart) from ps_cart); INSERT INTO ps_cart_product SELECT * FROM px_cart_product WHERE id_cart > (select max(id_cart) from ps_cart_product); INSERT INTO ps_customer SELECT * FROM px_customer WHERE id_customer > (select max(id_customer) from ps_customer); INSERT INTO ps_customer_group SELECT * FROM px_customer_group WHERE id_customer > (select max(id_customer) from ps_customer_group); INSERT INTO ps_customer_message SELECT * FROM px_customer_message WHERE id_customer_message > (select max(id_customer_message) from ps_customer_message); INSERT INTO ps_customer_thread SELECT * FROM px_customer_thread WHERE id_customer_thread > (select max(id_customer_thread) from ps_customer_thread); INSERT INTO ps_message SELECT * FROM px_message WHERE id_message > (select max(id_message) from ps_message); INSERT INTO ps_orders SELECT * FROM px_orders WHERE id_order > (select max(id_order) from ps_orders); INSERT INTO ps_order_carrier SELECT * FROM px_order_carrier WHERE id_order > (select max(id_order) from ps_order_carrier); INSERT INTO ps_order_detail SELECT * FROM px_order_detail WHERE id_order > (select max(id_order) from ps_order_detail); INSERT INTO ps_order_detail_tax SELECT * FROM px_order_detail_tax WHERE id_order_detail > (select max(id_order_detail) from ps_order_detail_tax); INSERT INTO ps_order_history SELECT * FROM px_order_history WHERE id_order_history > (select max(id_order_history) from ps_order_history); INSERT INTO ps_order_invoice SELECT * FROM px_order_invoice WHERE id_order > (select max(id_order) from ps_order_invoice); INSERT INTO ps_order_invoice_payment SELECT * FROM px_order_invoice_payment WHERE id_order_invoice > (select max(id_order_invoice) from ps_order_invoice_payment); INSERT INTO ps_order_invoice_tax SELECT * FROM px_order_invoice_tax WHERE id_order_invoice > (select max(id_order_invoice) from ps_order_invoice_tax); INSERT INTO ps_order_payment SELECT * FROM px_order_payment WHERE id_order_payment > (select max(id_order_payment) from ps_order_payment);
Dla przykładu. Jak widać w sprytny sposób pobieramy tutaj maksymalną wartość z tabeli przed rejestracji nowego adresu (ps_address):
select max(id_address) from ps_address
W MySQL zwróci ona konkretny ID:
+-----------------+ | max(id_address) | +-----------------+ | 17341 | +-----------------+ 1 row in set (0,008 sec)
Następnie wgrywamy z bliźniaczej kolumny z aktualnie działającego sklepu (px_address) nowe dane, które się pojawiły. Czyli wszystkie te, większe od id_address = 17341 🙂
Poprawa struktur tabel w bazie danych
Najlepiej każde zapytanie wykonywać osobno. Tj. każdą linikę INSERT. W razie wystąpienia błędu w zapytaniu należy skorygować tabele. UWAGA! Zmieniamy strukturę tabel z prefixem px_. Tabele używane przez sklep tzn. z prefixem ps_ pozostawiamy bez zmian. Przykładowe zapytanie, które skoryguje tabele z prefixem px_
ALTER TABLE `px_cart` ADD `checkout_session_data` LONGTEXT NULL AFTER `secure_key`; ALTER TABLE `px_cart_product` ADD `id_customization` INT(10) NULL AFTER `id_product_attribute`; ALTER TABLE `px_customer` ADD `reset_password_token` VARCHAR(40) NULL AFTER `company`, ADD `reset_password_validity` DATETIME NULL AFTER `reset_password_token`; ALTER TABLE `px_orders` ADD `note` TEXT NULL AFTER `date_upd`; ALTER TABLE `px_order_detail` ADD `id_customization` INT(10) NULL AFTER `product_attribute_id`; ALTER TABLE `px_order_detail` ADD `product_mpn` VARCHAR(40) NULL AFTER `product_upc`; ALTER TABLE `px_order_detail` ADD `total_refunded_tax_excl` DECIMAL(20,6) NULL AFTER `original_wholesale_price`, ADD `total_refunded_tax_incl` DECIMAL(20,6) NULL AFTER `total_refunded_tax_excl`; ALTER TABLE `px_order_detail` ADD `product_isbn` VARCHAR(32) NULL AFTER `product_ean13`; ALTER TABLE `px_order_invoice` DROP `invoice_address`, DROP `delivery_address`;
Jak widać chodzi z grubsza o dodanie brakujących kolumn (w dokładnie wyznaczonych miejscach tj. po ściśle określonych kolumnach) lub usunięcie zbędnych.
UWAGA! Zapytanie powyżej dotyczy wersji PrestaShop 1.7.8.3. W Twoim przypadku mogą one wyglądać inaczej.
W przypadku, gdy struktury bliźniaczych tabel się nie zgadzają – natrafimy na komunikat MySQL z błędem:
ERROR 1136 (21S01): Column count doesn't match value count at row 1
Oznacza to, że dane nie zostały skopiowane. Nie możemy tak tego zostawić. Baza będzie niespójna i sklep prędzej czy później będzie działał wadliwie. Odpowiednio porównaj obie tabele i wykonaj działania, aby struktury zostały ujednolicone. Zostało to przedstawione w cytowanym wyżej artykule (chodzi o pkt. 7 cytowanego artykułu):
Aktualizacja PrestaShop do 1.7 – dane starego sklepu w zupełnie czystej instalacji PS17 [UPDATE]
Czyli dodaj brakujące kolumny, usuń nadmiarowe, zmień kolejność kolumn itp. Zależy to od wersji PrestaShop nad którą pracujesz.
Zapytanie bez konieczności ustawiania kolejności
Opcjonalnie można także zastosować zapytania typu:
INSERT INTO ps_customer (id_customer, id_shop_group, id_shop, id_gender, id_default_group, id_lang, id_risk, company, siret, ape, firstname, lastname, email, passwd, last_passwd_gen, birthday, newsletter, ip_registration_newsletter, newsletter_date_add, optin, website, outstanding_allow_amount, show_public_prices, max_payment_days, secure_key, note, active, is_guest, deleted, date_add, date_upd, reset_password_token, reset_password_validity, dni) SELECT id_customer, id_shop_group, id_shop, id_gender, id_default_group, id_lang, id_risk, company, siret, ape, firstname, lastname, email, passwd, last_passwd_gen, birthday, newsletter, ip_registration_newsletter, newsletter_date_add, optin, website, outstanding_allow_amount, show_public_prices, max_payment_days, secure_key, note, active, is_guest, deleted, date_add, date_upd, reset_password_token, reset_password_validity, dni FROM px_customer WHERE id_customer > (select max(id_customer) from ps_customer);
Czyli należy podać kolumny wsadowe oraz te z których kopiujemy. Ważne tutaj jest aby ilość kolumn się zgadzała. Ich kolejność nie nie jest istotna.
Takie zapytanie INSERT należy opracować dla każdej tabeli, z której kopiujemy z osobna.
Przykłady:
INSERT INTO ps_cart (id_cart, id_shop_group, id_shop, id_carrier, delivery_option, id_lang, id_address_delivery, id_address_invoice, id_currency, id_customer, id_guest, secure_key, recyclable, gift, gift_message, mobile_theme, allow_seperated_package, date_add, date_upd, checkout_session_data) SELECT id_cart, id_shop_group, id_shop, id_carrier, delivery_option, id_lang, id_address_delivery, id_address_invoice, id_currency, id_customer, id_guest, secure_key, recyclable, gift, gift_message, mobile_theme, allow_seperated_package, date_add, date_upd, checkout_session_data FROM px_cart WHERE id_cart > (select max(id_cart) from ps_cart);
INSERT INTO ps_cart_product (id_cart, id_product, id_address_delivery, id_shop, id_product_attribute, id_customization, quantity, date_add) SELECT id_cart, id_product, id_address_delivery, id_shop, id_product_attribute, id_customization, quantity, date_add FROM px_cart_product WHERE id_cart > (select max(id_cart) from ps_cart_product);
INSERT INTO ps_orders (id_order, reference, id_shop_group, id_shop, id_carrier, id_lang, id_customer, id_cart, id_currency, id_address_delivery, id_address_invoice, current_state, secure_key, payment, conversion_rate, module, recyclable, gift, gift_message, mobile_theme, shipping_number, total_discounts, total_discounts_tax_incl, total_discounts_tax_excl, total_paid, total_paid_tax_incl, total_paid_tax_excl, total_paid_real, total_products, total_products_wt, total_shipping, total_shipping_tax_incl, total_shipping_tax_excl, carrier_tax_rate, total_wrapping, total_wrapping_tax_incl, total_wrapping_tax_excl, round_mode, round_type, invoice_number, delivery_number, invoice_date, delivery_date, valid, date_add, date_upd, note) SELECT id_order, reference, id_shop_group, id_shop, id_carrier, id_lang, id_customer, id_cart, id_currency, id_address_delivery, id_address_invoice, current_state, secure_key, payment, conversion_rate, module, recyclable, gift, gift_message, mobile_theme, shipping_number, total_discounts, total_discounts_tax_incl, total_discounts_tax_excl, total_paid, total_paid_tax_incl, total_paid_tax_excl, total_paid_real, total_products, total_products_wt, total_shipping, total_shipping_tax_incl, total_shipping_tax_excl, carrier_tax_rate, total_wrapping, total_wrapping_tax_incl, total_wrapping_tax_excl, round_mode, round_type, invoice_number, delivery_number, invoice_date, delivery_date, valid, date_add, date_upd, note FROM px_orders WHERE id_order > (select max(id_order) from ps_orders);
INSERT INTO ps_order_detail (id_order_detail, id_order, id_order_invoice, id_warehouse, id_shop, product_id, product_attribute_id, id_customization, product_name, product_quantity, product_quantity_in_stock, product_quantity_refunded, product_quantity_return, product_quantity_reinjected, product_price, reduction_percent, reduction_amount, reduction_amount_tax_incl, reduction_amount_tax_excl, group_reduction, product_quantity_discount, product_ean13, product_isbn, product_upc, product_mpn, product_reference, product_supplier_reference, product_weight, id_tax_rules_group, tax_computation_method, tax_name, tax_rate, ecotax, ecotax_tax_rate, discount_quantity_applied, download_hash, download_nb, download_deadline, total_price_tax_incl, total_price_tax_excl, unit_price_tax_incl, unit_price_tax_excl, total_shipping_price_tax_incl, total_shipping_price_tax_excl, purchase_supplier_price, original_product_price, original_wholesale_price, total_refunded_tax_excl, total_refunded_tax_incl) SELECT id_order_detail, id_order, id_order_invoice, id_warehouse, id_shop, product_id, product_attribute_id, id_customization, product_name, product_quantity, product_quantity_in_stock, product_quantity_refunded, product_quantity_return, product_quantity_reinjected, product_price, reduction_percent, reduction_amount, reduction_amount_tax_incl, reduction_amount_tax_excl, group_reduction, product_quantity_discount, product_ean13, product_isbn, product_upc, product_mpn, product_reference, product_supplier_reference, product_weight, id_tax_rules_group, tax_computation_method, tax_name, tax_rate, ecotax, ecotax_tax_rate, discount_quantity_applied, download_hash, download_nb, download_deadline, total_price_tax_incl, total_price_tax_excl, unit_price_tax_incl, unit_price_tax_excl, total_shipping_price_tax_incl, total_shipping_price_tax_excl, purchase_supplier_price, original_product_price, original_wholesale_price, total_refunded_tax_excl, total_refunded_tax_incl FROM px_order_detail WHERE id_order > (select max(id_order) from ps_order_detail);
INSERT INTO ps_order_invoice (id_order_invoice, id_order, number, delivery_number, delivery_date, total_discount_tax_excl, total_discount_tax_incl, total_paid_tax_excl, total_paid_tax_incl, total_products, total_products_wt, total_shipping_tax_excl, total_shipping_tax_incl, shipping_tax_computation_method, total_wrapping_tax_excl, total_wrapping_tax_incl, shop_address, note, date_add) SELECT id_order_invoice, id_order, number, delivery_number, delivery_date, total_discount_tax_excl, total_discount_tax_incl, total_paid_tax_excl, total_paid_tax_incl, total_products, total_products_wt, total_shipping_tax_excl, total_shipping_tax_incl, shipping_tax_computation_method, total_wrapping_tax_excl, total_wrapping_tax_incl, shop_address, note, date_add FROM px_order_invoice WHERE id_order > (select max(id_order) from ps_order_invoice);
Pełne zapytanie (dość długie) ale uwzlędniające także modyfikację tabel z prefixem „px_„:
INSERT INTO pr_address SELECT * FROM px_address WHERE id_address > (select max(id_address) from pr_address); ALTER TABLE `px_cart` ADD `checkout_session_data` MEDIUMINT NULL AFTER `secure_key`; INSERT INTO pr_cart (id_cart, id_shop_group, id_shop, id_carrier, delivery_option, id_lang, id_address_delivery, id_address_invoice, id_currency, id_customer, id_guest, secure_key, recyclable, gift, gift_message, mobile_theme, allow_seperated_package, date_add, date_upd, checkout_session_data) SELECT id_cart, id_shop_group, id_shop, id_carrier, delivery_option, id_lang, id_address_delivery, id_address_invoice, id_currency, id_customer, id_guest, secure_key, recyclable, gift, gift_message, mobile_theme, allow_seperated_package, date_add, date_upd, checkout_session_data FROM px_cart WHERE id_cart > (select max(id_cart) from pr_cart); ALTER TABLE `px_cart_product` ADD `id_customization` INT(10) NULL AFTER `id_shop`; INSERT INTO pr_cart_product (id_cart, id_product, id_address_delivery, id_shop, id_product_attribute, id_customization, quantity, date_add) SELECT id_cart, id_product, id_address_delivery, id_shop, id_product_attribute, id_customization, quantity, date_add FROM px_cart_product WHERE id_cart > (select max(id_cart) from pr_cart_product); ALTER TABLE `px_customer` ADD `reset_password_token` VARCHAR(40) NULL AFTER `company`, ADD `reset_password_validity` DATETIME NULL AFTER `reset_password_token`; INSERT INTO pr_customer (id_customer, id_shop_group, id_shop, id_gender, id_default_group, id_lang, id_risk, company, siret, ape, firstname, lastname, email, passwd, last_passwd_gen, birthday, newsletter, ip_registration_newsletter, newsletter_date_add, optin, website, outstanding_allow_amount, show_public_prices, max_payment_days, secure_key, note, active, is_guest, deleted, date_add, date_upd, reset_password_token, reset_password_validity, dni) SELECT id_customer, id_shop_group, id_shop, id_gender, id_default_group, id_lang, id_risk, company, siret, ape, firstname, lastname, email, passwd, last_passwd_gen, birthday, newsletter, ip_registration_newsletter, newsletter_date_add, optin, website, outstanding_allow_amount, show_public_prices, max_payment_days, secure_key, note, active, is_guest, deleted, date_add, date_upd, reset_password_token, reset_password_validity, dni FROM px_customer WHERE id_customer > (select max(id_customer) from pr_customer); INSERT INTO pr_customer_group SELECT * FROM px_customer_group WHERE id_customer > (select max(id_customer) from pr_customer_group); INSERT INTO pr_customer_message SELECT * FROM px_customer_message WHERE id_customer_message > (select max(id_customer_message) from pr_customer_message); INSERT INTO pr_customer_thread SELECT * FROM px_customer_thread WHERE id_customer_thread > (select max(id_customer_thread) from pr_customer_thread); INSERT INTO pr_message SELECT * FROM px_message WHERE id_message > (select max(id_message) from pr_message); ALTER TABLE `px_orders` ADD `note` TEXT NULL AFTER `total_wrapping_tax_incl`; INSERT INTO pr_orders (id_order, reference, id_shop_group, id_shop, id_carrier, id_lang, id_customer, id_cart, id_currency, id_address_delivery, id_address_invoice, current_state, secure_key, payment, conversion_rate, module, recyclable, gift, gift_message, mobile_theme, shipping_number, total_discounts, total_discounts_tax_incl, total_discounts_tax_excl, total_paid, total_paid_tax_incl, total_paid_tax_excl, total_paid_real, total_products, total_products_wt, total_shipping, total_shipping_tax_incl, total_shipping_tax_excl, carrier_tax_rate, total_wrapping, total_wrapping_tax_incl, total_wrapping_tax_excl, round_mode, round_type, invoice_number, delivery_number, invoice_date, delivery_date, valid, date_add, date_upd, note) SELECT id_order, reference, id_shop_group, id_shop, id_carrier, id_lang, id_customer, id_cart, id_currency, id_address_delivery, id_address_invoice, current_state, secure_key, payment, conversion_rate, module, recyclable, gift, gift_message, mobile_theme, shipping_number, total_discounts, total_discounts_tax_incl, total_discounts_tax_excl, total_paid, total_paid_tax_incl, total_paid_tax_excl, total_paid_real, total_products, total_products_wt, total_shipping, total_shipping_tax_incl, total_shipping_tax_excl, carrier_tax_rate, total_wrapping, total_wrapping_tax_incl, total_wrapping_tax_excl, round_mode, round_type, invoice_number, delivery_number, invoice_date, delivery_date, valid, date_add, date_upd, note FROM px_orders WHERE id_order > (select max(id_order) from pr_orders); INSERT INTO pr_order_carrier SELECT * FROM px_order_carrier WHERE id_order > (select max(id_order) from pr_order_carrier); ALTER TABLE `px_order_detail` ADD `id_customization` INT(11) NULL AFTER `original_wholesale_price`; ALTER TABLE `px_order_detail` ADD `product_isbn` VARCHAR(32) NULL AFTER `id_customization`; ALTER TABLE `px_order_detail` ADD `product_mpn` VARCHAR(40) NULL AFTER `id_customization`; ALTER TABLE `px_order_detail` ADD `total_refunded_tax_excl` DECIMAL(20,6) NOT NULL AFTER `product_isbn`, ADD `total_refunded_tax_incl` DECIMAL(20,6) NOT NULL AFTER `total_refunded_tax_excl`; INSERT INTO pr_order_detail (id_order_detail, id_order, id_order_invoice, id_warehouse, id_shop, product_id, product_attribute_id, id_customization, product_name, product_quantity, product_quantity_in_stock, product_quantity_refunded, product_quantity_return, product_quantity_reinjected, product_price, reduction_percent, reduction_amount, reduction_amount_tax_incl, reduction_amount_tax_excl, group_reduction, product_quantity_discount, product_ean13, product_isbn, product_upc, product_mpn, product_reference, product_supplier_reference, product_weight, id_tax_rules_group, tax_computation_method, tax_name, tax_rate, ecotax, ecotax_tax_rate, discount_quantity_applied, download_hash, download_nb, download_deadline, total_price_tax_incl, total_price_tax_excl, unit_price_tax_incl, unit_price_tax_excl, total_shipping_price_tax_incl, total_shipping_price_tax_excl, purchase_supplier_price, original_product_price, original_wholesale_price, total_refunded_tax_excl, total_refunded_tax_incl) SELECT id_order_detail, id_order, id_order_invoice, id_warehouse, id_shop, product_id, product_attribute_id, id_customization, product_name, product_quantity, product_quantity_in_stock, product_quantity_refunded, product_quantity_return, product_quantity_reinjected, product_price, reduction_percent, reduction_amount, reduction_amount_tax_incl, reduction_amount_tax_excl, group_reduction, product_quantity_discount, product_ean13, product_isbn, product_upc, product_mpn, product_reference, product_supplier_reference, product_weight, id_tax_rules_group, tax_computation_method, tax_name, tax_rate, ecotax, ecotax_tax_rate, discount_quantity_applied, download_hash, download_nb, download_deadline, total_price_tax_incl, total_price_tax_excl, unit_price_tax_incl, unit_price_tax_excl, total_shipping_price_tax_incl, total_shipping_price_tax_excl, purchase_supplier_price, original_product_price, original_wholesale_price, total_refunded_tax_excl, total_refunded_tax_incl FROM px_order_detail WHERE id_order > (select max(id_order) from pr_order_detail); INSERT INTO pr_order_detail_tax SELECT * FROM px_order_detail_tax WHERE id_order_detail > (select max(id_order_detail) from pr_order_detail_tax); INSERT INTO pr_order_history SELECT * FROM px_order_history WHERE id_order_history > (select max(id_order_history) from pr_order_history); INSERT INTO pr_order_invoice (id_order_invoice, id_order, number, delivery_number, delivery_date, total_discount_tax_excl, total_discount_tax_incl, total_paid_tax_excl, total_paid_tax_incl, total_products, total_products_wt, total_shipping_tax_excl, total_shipping_tax_incl, shipping_tax_computation_method, total_wrapping_tax_excl, total_wrapping_tax_incl, shop_address, note, date_add) SELECT id_order_invoice, id_order, number, delivery_number, delivery_date, total_discount_tax_excl, total_discount_tax_incl, total_paid_tax_excl, total_paid_tax_incl, total_products, total_products_wt, total_shipping_tax_excl, total_shipping_tax_incl, shipping_tax_computation_method, total_wrapping_tax_excl, total_wrapping_tax_incl, shop_address, note, date_add FROM px_order_invoice WHERE id_order > (select max(id_order) from pr_order_invoice); INSERT INTO pr_order_invoice_payment SELECT * FROM px_order_invoice_payment WHERE id_order_invoice > (select max(id_order_invoice) from pr_order_invoice_payment); INSERT INTO pr_order_invoice_tax SELECT * FROM px_order_invoice_tax WHERE id_order_invoice > (select max(id_order_invoice) from pr_order_invoice_tax); INSERT INTO pr_order_payment SELECT * FROM px_order_payment WHERE id_order_payment > (select max(id_order_payment) from pr_order_payment);
Poprawa wartości NULL
Następnym krokiem jest poprawienie wartości NULL, które mogą pojawić się w dodatkowych tabelach. Wykonaj zapytanie z tego artykułu:
W innym wypadku mogą być problemy z wyświetleniem szczegółów zamówienia.
Ważne: tutaj już wykonaj zapytania na tabelach ps_ Korygujemy tabele używane przez sklep, który korygujemy.
Gotowe! Nowe dane ze starego sklepu zostały „dokoptowane” do nowej bazy danych.
grafika: alphacoders.com