diff --git a/mysql/migration/2.6.0-2.7.0.sql b/mysql/migration/2.6.0-2.7.0.sql index 4e855f355a6..4edd80ad1b1 100644 --- a/mysql/migration/2.6.0-2.7.0.sql +++ b/mysql/migration/2.6.0-2.7.0.sql @@ -32,6 +32,7 @@ ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER re ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber; ALTER TABLE llx_livraison ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; ALTER TABLE llx_fichinter ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; +ALTER TABLE llx_contrat ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; ALTER TABLE llx_rights_def DROP PRIMARY KEY; ALTER TABLE llx_user_param DROP INDEX fk_user; @@ -75,4 +76,5 @@ ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, en ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity); ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity); ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity); -ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity); \ No newline at end of file +ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity); +ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity); \ No newline at end of file diff --git a/mysql/tables/llx_contrat.key.sql b/mysql/tables/llx_contrat.key.sql index a355ae22342..1c757fa6c86 100644 --- a/mysql/tables/llx_contrat.key.sql +++ b/mysql/tables/llx_contrat.key.sql @@ -1,6 +1,7 @@ -- ============================================================================ -- Copyright (C) 2002-2004 Rodolphe Quiedeville -- Copyright (C) 2004-2005 Laurent Destailleur +-- Copyright (C) 2005-2009 Regis Houssin -- -- 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 @@ -25,6 +26,8 @@ -- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_societe ON llx_contrat.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL; -- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_user ON llx_contrat.fk_user_author = llx_user.rowid WHERE llx_user.rowid IS NULL; +ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity); + ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_soc (fk_soc); ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author); diff --git a/mysql/tables/llx_contrat.sql b/mysql/tables/llx_contrat.sql index ea30f2cd20a..0d2bc7770de 100644 --- a/mysql/tables/llx_contrat.sql +++ b/mysql/tables/llx_contrat.sql @@ -1,6 +1,7 @@ -- ============================================================================ -- Copyright (C) 2002-2004 Rodolphe Quiedeville -- Copyright (C) 2004-2005 Laurent Destailleur +-- Copyright (C) 2005-2009 Regis Houssin -- -- 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 @@ -21,23 +22,25 @@ create table llx_contrat ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30), -- reference de contrat - tms timestamp, - datec datetime, -- date de creation de l'enregistrement - date_contrat datetime, - statut smallint DEFAULT 0, - mise_en_service datetime, - fin_validite datetime, - date_cloture datetime, - fk_soc integer NOT NULL, - fk_projet integer, - fk_commercial_signature integer NOT NULL, -- obsolete + rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(30), -- reference de contrat + entity integer DEFAULT 1 NOT NULL, -- multi company id + tms timestamp, + datec datetime, -- date de creation de l enregistrement + date_contrat datetime, + statut smallint DEFAULT 0, + mise_en_service datetime, + fin_validite datetime, + date_cloture datetime, + fk_soc integer NOT NULL, + fk_projet integer, + fk_commercial_signature integer NOT NULL, -- obsolete fk_commercial_suivi integer NOT NULL, -- obsolete fk_user_author integer NOT NULL default 0, fk_user_mise_en_service integer, - fk_user_cloture integer, - note text, - note_public text + fk_user_cloture integer, + note text, + note_public text + )type=innodb;