diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql index 0b5e28540f4..a5ae3f514e4 100644 --- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql +++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql @@ -160,6 +160,35 @@ CREATE TABLE llx_bank_record_link fk_bank_import integer NOT NULL )ENGINE=innodb; +CREATE TABLE llx_bank_import +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + id_account integer NOT NULL, -- bank account ID in Dolibarr + record_type varchar(64) NULL, -- OFX Type of transaction: DIRECTDEBIT, XFER, OTHER or code/type of operation + label varchar(255) NOT NULL, -- label of operation + record_type_origin varchar(255) NOT NULL, -- operation code/type origin + label_origin varchar(255) NOT NULL, -- label of operation origin + comment text NULL, -- Comment/Motif + note text NULL, -- Notes like "References" + bdate date NULL, -- date operation + vdate date NULL, -- date value + date_scraped datetime NULL, -- date discarded + original_amount double(24,8) NULL, -- OFX amount + original_currency varchar(255) NULL, -- OFX Currency + amount_debit double(24,8) NOT NULL, -- money spent. For statement using debit/credit. For statement using 1 amount, use original_amount. + amount_credit double(24,8) NOT NULL, -- money received. For statement using debit/credit. For statement using 1 amount, use original_amount. + deleted_date datetime NULL, -- to flag this record as deleted + fk_duplicate_of integer NULL, -- to flag this record as a duplicate of another one + status smallint NOT NULL, -- 0=just imported + datec datetime NOT NULL, -- date creation + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date of last modification + fk_user_author integer NOT NULL, -- user who created the record + fk_user_modif integer, -- user who modified the record + import_key varchar(14), -- import key + datas text NOT NULL -- full record/line coming from source +)ENGINE=innodb; + + ALTER TABLE llx_bank_record_link ADD CONSTRAINT fk_bank_record_bank_record FOREIGN KEY (fk_bank_record) REFERENCES llx_bank_record (rowid); ALTER TABLE llx_bank_record_link ADD CONSTRAINT fk_bank_import_bank_import FOREIGN KEY (fk_bank_import) REFERENCES llx_bank_import (rowid);