diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index 0aa7f3bea02..0cce85d8ea0 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -321,9 +321,13 @@ alter table llx_propaldet add column rang integer DEFAULT 0; alter table llx_facture drop column model; alter table llx_facture add column model_pdf varchar(50) after note_public; -alter table llx_facture add column fk_facture integer after fk_user_valid; -ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture (fk_facture); -ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); + +alter table llx_facture drop foreign key fk_facture_fk_facture; +alter table llx_facture drop column fk_facture; +alter table llx_facture add column fk_facture_source integer after fk_user_valid; +ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture_source (fk_facture_source); +ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_source_fk_facture FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid); +alter table llx_facture add column type smallint DEFAULT 0 NOT NULL after facnumber; -- drop table llx_societe_remise_except; diff --git a/mysql/tables/llx_facture.sql b/mysql/tables/llx_facture.sql index e27ad86b09b..fdc8584d32d 100644 --- a/mysql/tables/llx_facture.sql +++ b/mysql/tables/llx_facture.sql @@ -24,6 +24,7 @@ create table llx_facture ( rowid integer AUTO_INCREMENT PRIMARY KEY, facnumber varchar(30) NOT NULL, + type smallint DEFAULT 0 NOT NULL, ref_client varchar(30), increment varchar(10), fk_soc integer NOT NULL, @@ -48,7 +49,7 @@ create table llx_facture fk_user_author integer, -- createur de la facture fk_user_valid integer, -- valideur de la facture - fk_facture integer, -- facture origine si facture avoir + fk_facture_source integer, -- facture origine si facture avoir 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 ...)