diff --git a/mysql/migration/2.6.0-2.7.0.sql b/mysql/migration/2.6.0-2.7.0.sql index 5fe8164a3ec..80dba812bbd 100644 --- a/mysql/migration/2.6.0-2.7.0.sql +++ b/mysql/migration/2.6.0-2.7.0.sql @@ -29,6 +29,7 @@ ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NUL ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn; ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber; ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; +ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber; ALTER TABLE llx_rights_def DROP PRIMARY KEY; ALTER TABLE llx_user_param DROP INDEX fk_user; @@ -47,6 +48,7 @@ ALTER TABLE llx_product_fournisseur DROP INDEX fk_product; ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc; ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber; ALTER TABLE llx_expedition DROP INDEX idx_expedition_uk_ref; +ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref; ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity); ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity); @@ -65,4 +67,5 @@ ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity); ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity); ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity); -ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity); \ No newline at end of file +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); \ No newline at end of file diff --git a/mysql/tables/llx_facture_fourn.key.sql b/mysql/tables/llx_facture_fourn.key.sql index 09ad83483de..bc11ca42c8f 100644 --- a/mysql/tables/llx_facture_fourn.key.sql +++ b/mysql/tables/llx_facture_fourn.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 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 @@ -19,7 +20,7 @@ -- ============================================================================ -ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc); +ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity); ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_date_lim_reglement (date_lim_reglement); diff --git a/mysql/tables/llx_facture_fourn.sql b/mysql/tables/llx_facture_fourn.sql index 17475ad95d3..cbfaeff2673 100644 --- a/mysql/tables/llx_facture_fourn.sql +++ b/mysql/tables/llx_facture_fourn.sql @@ -1,6 +1,7 @@ -- =========================================================================== -- Copyright (C) 2001-2003 Rodolphe Quiedeville -- Copyright (C) 2007 Laurent Destailleur +-- Copyright (C) 2007-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,33 +22,36 @@ create table llx_facture_fourn ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - facnumber varchar(50) NOT NULL, - type smallint DEFAULT 0 NOT NULL, - fk_soc integer NOT NULL, - datec datetime, -- date de creation de la facture - datef date, -- date de la facture - libelle varchar(255), - paye smallint DEFAULT 0 NOT NULL, - amount double(24,8) DEFAULT 0 NOT NULL, - remise double(24,8) DEFAULT 0, - tva double(24,8) DEFAULT 0, - total double(24,8) DEFAULT 0, - total_ht double(24,8) DEFAULT 0, - total_tva double(24,8) DEFAULT 0, - total_ttc double(24,8) DEFAULT 0, + rowid integer AUTO_INCREMENT PRIMARY KEY, + facnumber varchar(50) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + type smallint DEFAULT 0 NOT NULL, + fk_soc integer NOT NULL, + + datec datetime, -- date de creation de la facture + datef date, -- date de la facture + libelle varchar(255), + paye smallint DEFAULT 0 NOT NULL, + amount double(24,8) DEFAULT 0 NOT NULL, + remise double(24,8) DEFAULT 0, + tva double(24,8) DEFAULT 0, + total double(24,8) DEFAULT 0, + total_ht double(24,8) DEFAULT 0, + total_tva double(24,8) DEFAULT 0, + total_ttc double(24,8) DEFAULT 0, - fk_statut smallint DEFAULT 0 NOT NULL, + fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author integer, -- createur de la facture - fk_user_valid integer, -- valideur de la facture + fk_user_author integer, -- createur de la facture + fk_user_valid integer, -- valideur de la facture - fk_projet integer, -- projet auquel est associée la facture + fk_projet integer, -- projet auquel est associée la facture fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) - date_lim_reglement date, -- date limite de reglement + date_lim_reglement date, -- date limite de reglement - note text, - note_public text, - import_key varchar(14) + note text, + note_public text, + import_key varchar(14) + )type=innodb;