diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index eab10d7838347df817cfed7e1c8bb5a7803094c9..663af76b0cdd7430b80ea113691b34a0fc09b32e 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -3,6 +3,17 @@ -- when current version is 2.6.0 or higher. -- + +-- Replace xxx with your IP Address +-- bind-address = xxx.xxx.xxx.xxx +-- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; +-- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; +-- GRANT ALL ON *.* TO 'myuser'@'localhost'; +-- GRANT ALL ON *.* TO 'myuser'@'%'; +-- flush privileges; + + + -- Requests to clean corrupted database @@ -214,14 +225,6 @@ UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS -- List of product into 2 categories xxx: select cp.fk_product, count(cp.fk_product) as nb from llx_categorie_product as cp, llx_categorie as c where cp.fk_categorie = c.rowid and c.label like 'xxx-%' group by fk_product having nb > 1; -- List of product with no category xxx yet: select rowid, ref from llx_product where rowid not in (select distinct cp.fk_product from llx_categorie_product as cp, llx_categorie as c where cp.fk_categorie = c.rowid and c.label like 'xxx-%' order by fk_product); --- Replace xxx with your IP Address --- bind-address = xxx.xxx.xxx.xxx --- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; --- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; --- GRANT ALL ON *.* TO 'myuser'@'localhost'; --- GRANT ALL ON *.* TO 'myuser'@'%'; --- flush privileges; - -- Fix type of product 2 does not exists update llx_propaldet set product_type = 1 where product_type = 2; update llx_commandedet set product_type = 1 where product_type = 2; @@ -241,3 +244,10 @@ delete from llx_menu where menu_handler = 'smartphone'; update llx_projet_task as pt set pt.duration_effective = (select SUM(ptt.task_duration) as y from llx_projet_task_time as ptt where ptt.fk_task = pt.rowid) where pt.duration_effective <> (select SUM(ptt.task_duration) as y from llx_projet_task_time as ptt where ptt.fk_task = pt.rowid) +-- Remove duplicate of shipment mode (keep the one with tracking defined) +drop table tmp_c_shipment_mode; +create table tmp_c_shipment_mode as (select code, tracking from llx_c_shipment_mode); +DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_mode WHERE tracking is NULL OR tracking = '') AND code IN (select code from tmp_c_shipment_mode WHERE tracking is NOT NULL AND tracking != '') AND (tracking IS NULL OR tracking = ''); +drop table tmp_c_shipment_mode; + + diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql new file mode 100644 index 0000000000000000000000000000000000000000..15058c0630e7f1e6c756f9dd75d3071a92e02f33 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- =================================================================== + +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code); +