From be79c06c728e3051063a780d5f14b1e46a743561 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 4 Nov 2012 15:21:08 +0100 Subject: [PATCH] Set unique key index unique in db (Conform to SQL standard) and needed for migration to other SGBD --- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 9 +++++++++ htdocs/install/mysql/tables/llx_c_actioncomm.sql | 7 ++++--- htdocs/install/mysql/tables/llx_c_civilite.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_effectif.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_paiement.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_propalst.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_stcomm.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_type_fees.sql | 5 +++-- htdocs/install/mysql/tables/llx_c_typent.sql | 5 +++-- 9 files changed, 34 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index a7add395e4c..8bd69792d88 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -464,3 +464,12 @@ UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'SOCIETE_CODECOMPTA_ADDON' AND __DECRYPT('value')__ = 'mod_codecompta_digitaria'; ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity); + +ALTER TABLE llx_c_actioncomm DROP INDEX code, ADD UNIQUE uk_c_actioncomm (code); +ALTER TABLE llx_c_civilite DROP INDEX code, ADD UNIQUE uk_c_civilite (code); +ALTER TABLE llx_c_propalst DROP INDEX code, ADD UNIQUE uk_c_propalst (code); +ALTER TABLE llx_c_stcomm DROP INDEX code, ADD UNIQUE uk_c_stcomm (code); +ALTER TABLE llx_c_type_fees DROP INDEX code, ADD UNIQUE uk_c_type_fees (code); +ALTER TABLE llx_c_typent DROP INDEX code, ADD UNIQUE uk_c_typent (code); +ALTER TABLE llx_c_effectif DROP INDEX code, ADD UNIQUE uk_c_effectif (code); +ALTER TABLE llx_c_paiement DROP INDEX code, ADD UNIQUE uk_c_paiement (code); diff --git a/htdocs/install/mysql/tables/llx_c_actioncomm.sql b/htdocs/install/mysql/tables/llx_c_actioncomm.sql index 89ca529045e..a5b96b4ea10 100644 --- a/htdocs/install/mysql/tables/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_c_actioncomm.sql @@ -20,11 +20,12 @@ create table llx_c_actioncomm ( id integer PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, type varchar(10) DEFAULT 'system' NOT NULL, libelle varchar(48) NOT NULL, - module varchar(16) DEFAULT NULL, + module varchar(16) DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, todo tinyint, - position integer NOT NULL DEFAULT 0 + position integer NOT NULL DEFAULT 0, + UNIQUE KEY uk_c_actioncomm (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_civilite.sql b/htdocs/install/mysql/tables/llx_c_civilite.sql index f3dfd71f66b..65d6542cc5a 100644 --- a/htdocs/install/mysql/tables/llx_c_civilite.sql +++ b/htdocs/install/mysql/tables/llx_c_civilite.sql @@ -20,9 +20,10 @@ create table llx_c_civilite ( rowid integer PRIMARY KEY, - code varchar(6) UNIQUE NOT NULL, + code varchar(6) NOT NULL, civilite varchar(50), active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + UNIQUE KEY uk_c_civilite (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_effectif.sql b/htdocs/install/mysql/tables/llx_c_effectif.sql index 879507c1de7..ca3c64e710c 100644 --- a/htdocs/install/mysql/tables/llx_c_effectif.sql +++ b/htdocs/install/mysql/tables/llx_c_effectif.sql @@ -20,9 +20,10 @@ create table llx_c_effectif ( id integer PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, libelle varchar(30), active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + UNIQUE KEY uk_c_effectif (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index 256308dcdea..5097d60f89e 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -27,11 +27,12 @@ create table llx_c_paiement ( id integer PRIMARY KEY, - code varchar(6) UNIQUE NOT NULL, + code varchar(6) NOT NULL, libelle varchar(30), type smallint, active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + UNIQUE KEY uk_c_paiement (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_propalst.sql b/htdocs/install/mysql/tables/llx_c_propalst.sql index 478176ea00f..64b34f3c9ad 100644 --- a/htdocs/install/mysql/tables/llx_c_propalst.sql +++ b/htdocs/install/mysql/tables/llx_c_propalst.sql @@ -20,8 +20,9 @@ create table llx_c_propalst ( id smallint PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, label varchar(30), - active tinyint DEFAULT 1 NOT NULL + active tinyint DEFAULT 1 NOT NULL, + UNIQUE KEY uk_c_propalst (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_stcomm.sql b/htdocs/install/mysql/tables/llx_c_stcomm.sql index 681ac2fc338..13616b8872b 100644 --- a/htdocs/install/mysql/tables/llx_c_stcomm.sql +++ b/htdocs/install/mysql/tables/llx_c_stcomm.sql @@ -20,8 +20,9 @@ create table llx_c_stcomm ( id integer PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, libelle varchar(30), - active tinyint default 1 NOT NULL + active tinyint default 1 NOT NULL, + UNIQUE KEY uk_c_stcomm (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_type_fees.sql b/htdocs/install/mysql/tables/llx_c_type_fees.sql index 1a40dff1016..f2154f475c6 100644 --- a/htdocs/install/mysql/tables/llx_c_type_fees.sql +++ b/htdocs/install/mysql/tables/llx_c_type_fees.sql @@ -20,8 +20,9 @@ create table llx_c_type_fees ( id integer AUTO_INCREMENT PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, libelle varchar(30), active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + UNIQUE KEY uk_c_type_fees (code) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index 151fab64de9..66c3c10bd41 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -20,8 +20,9 @@ create table llx_c_typent ( id integer PRIMARY KEY, - code varchar(12) UNIQUE NOT NULL, + code varchar(12) NOT NULL, libelle varchar(30), active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + UNIQUE KEY uk_c_typent (code) )ENGINE=innodb;