10.0.0-11.0.0.sql 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. --
  2. -- Be carefull to requests order.
  3. -- This file must be loaded by calling /install/index.php page
  4. -- when current version is 11.0.0 or higher.
  5. --
  6. -- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
  7. -- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
  8. -- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
  9. -- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
  10. -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
  11. -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
  12. -- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
  13. -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
  14. -- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
  15. -- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
  16. -- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
  17. -- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
  18. -- To make pk to be auto increment (postgres):
  19. -- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
  20. -- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
  21. -- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
  22. -- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
  23. -- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
  24. -- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
  25. -- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
  26. -- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
  27. -- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
  28. -- Note: fields with type BLOB/TEXT can't have default value.
  29. -- Missing in v10
  30. ALTER TABLE llx_account_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
  31. ALTER TABLE llx_expensereport ADD COLUMN paid smallint default 0 NOT NULL;
  32. UPDATE llx_expensereport set paid = 1 WHERE fk_statut = 6 and paid = 0;
  33. UPDATE llx_c_units SET short_label = 'i' WHERE code = 'MI';
  34. UPDATE llx_c_units SET unit_type = 'weight', short_label = 'kg', scale = 0 WHERE code = 'KG';
  35. UPDATE llx_c_units SET unit_type = 'weight', short_label = 'g', scale = -3 WHERE code = 'G';
  36. UPDATE llx_c_units SET unit_type = 'time' WHERE code IN ('S','H','D');
  37. UPDATE llx_c_units SET unit_type = 'size' WHERE code IN ('M','LM');
  38. UPDATE llx_c_units SET label = 'SizeUnitm', scale = 0 WHERE code IN ('M');
  39. UPDATE llx_c_units SET active = 0, scale = 0 WHERE code IN ('LM');
  40. UPDATE llx_c_units SET unit_type = 'surface', scale = 0 WHERE code IN ('M2');
  41. UPDATE llx_c_units SET unit_type = 'volume', scale = 0 WHERE code IN ('M3','L');
  42. UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L');
  43. UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3');
  44. UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
  45. ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
  46. ALTER TABLE llx_mailing_cibles MODIFY COLUMN lastname varchar(160);
  47. ALTER TABLE llx_mailing_cibles MODIFY COLUMN firstname varchar(160);
  48. ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN login varchar(128);
  49. ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN codelastresult varchar(16);
  50. ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer DEFAULT 0;
  51. -- For v11
  52. ALTER TABLE llx_product_price MODIFY COLUMN tva_tx double(6,3) DEFAULT 0 NOT NULL;
  53. ALTER TABLE llx_facturedet MODIFY COLUMN situation_percent real DEFAULT 100;
  54. UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;
  55. -- Set country to null for deprecated accounting system (there is now one per country)
  56. UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
  57. INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 20, 'BAS-K1-MINI', 'The Swedish mini chart of accounts', 1);
  58. ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(64) NOT NULL;
  59. ALTER TABLE llx_societe_account ADD COLUMN site_account varchar(128);
  60. UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL;
  61. -- VMYSQL4.3 ALTER TABLE llx_holiday MODIFY COLUMN ref varchar(30) NOT NULL;
  62. -- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref SET NOT NULL;
  63. ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL;
  64. insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1);
  65. INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL);
  66. ALTER TABLE llx_don ADD COLUMN fk_user_modif integer;
  67. ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
  68. ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
  69. ALTER TABLE llx_rights_def ADD COLUMN family_position INTEGER NOT NULL DEFAULT 0;
  70. UPDATE llx_rights_def SET subperms = 'write' WHERE perms = 'fiscalyear' AND module = 'accounting' AND subperms IS NULL;
  71. ALTER TABLE llx_bom_bom ADD COLUMN duration double(24,8) DEFAULT NULL;
  72. ALTER TABLE llx_bom_bom ADD COLUMN fk_warehouse integer;
  73. ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
  74. ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
  75. ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
  76. -- VMYSQL4.1 ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
  77. -- VPGSQL8.2 ALTER TABLE llx_bom_bomline DROP COLUMN rank;
  78. create table llx_categorie_warehouse
  79. (
  80. fk_categorie integer NOT NULL,
  81. fk_warehouse integer NOT NULL,
  82. import_key varchar(14)
  83. ) ENGINE=innodb;
  84. ALTER TABLE llx_categorie_warehouse ADD PRIMARY KEY pk_categorie_warehouse (fk_categorie, fk_warehouse);
  85. ALTER TABLE llx_categorie_warehouse ADD INDEX idx_categorie_warehouse_fk_categorie (fk_categorie);
  86. ALTER TABLE llx_categorie_warehouse ADD INDEX idx_categorie_warehouse_fk_warehouse (fk_warehouse);
  87. ALTER TABLE llx_categorie_warehouse ADD CONSTRAINT fk_categorie_warehouse_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
  88. ALTER TABLE llx_categorie_warehouse ADD CONSTRAINT fk_categorie_warehouse_fk_warehouse_rowid FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot (rowid);
  89. create table llx_holiday_extrafields
  90. (
  91. rowid integer AUTO_INCREMENT PRIMARY KEY,
  92. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  93. fk_object integer NOT NULL,
  94. import_key varchar(14) -- import key
  95. ) ENGINE=innodb;
  96. ALTER TABLE llx_holiday_extrafields ADD INDEX idx_holiday_extrafields (fk_object);
  97. ALTER TABLE llx_societe_rib MODIFY label varchar(200);
  98. ALTER TABLE llx_societe ADD COLUMN logo_squarred varchar(255);
  99. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300);
  100. create table llx_entrepot_extrafields
  101. (
  102. rowid integer AUTO_INCREMENT PRIMARY KEY,
  103. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  104. fk_object integer NOT NULL,
  105. import_key varchar(14) -- import key
  106. ) ENGINE=innodb;
  107. ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object);
  108. ALTER TABLE llx_extrafields ADD COLUMN printable boolean DEFAULT FALSE;
  109. ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final;
  110. ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty;
  111. ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit;
  112. ALTER TABLE llx_facture ADD COLUMN date_closing datetime DEFAULT NULL after date_valid;
  113. ALTER TABLE llx_facture ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid;
  114. ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL;
  115. ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode;
  116. ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity);
  117. ALTER TABLE llx_facture_fourn DROP COLUMN total;
  118. ALTER TABLE llx_user ADD COLUMN iplastlogin varchar(250);
  119. ALTER TABLE llx_user ADD COLUMN ippreviouslogin varchar(250);
  120. ALTER TABLE llx_events ADD COLUMN prefix_session varchar(255) NULL;
  121. create table llx_payment_salary_extrafields
  122. (
  123. rowid integer AUTO_INCREMENT PRIMARY KEY,
  124. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  125. fk_object integer NOT NULL, -- salary payment id
  126. import_key varchar(14) -- import key
  127. )ENGINE=innodb;
  128. ALTER TABLE llx_payment_salary_extrafields ADD INDEX idx_payment_salary_extrafields (fk_object);
  129. ALTER TABLE llx_c_price_expression MODIFY COLUMN expression varchar(255) NOT NULL;
  130. UPDATE llx_bank_url set url = REPLACE( url, 'compta/salaries/', 'salaries/');
  131. ALTER TABLE llx_stock_mouvement ADD COLUMN fk_projet INTEGER NOT NULL DEFAULT 0 AFTER model_pdf;
  132. ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
  133. ALTER TABLE llx_adherent_type ADD COLUMN duration varchar(6) DEFAULT NULL after morphy;
  134. ALTER TABLE llx_mailing ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
  135. ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
  136. ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0;
  137. ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1;
  138. ALTER TABLE llx_projet CHANGE COLUMN bill_time usage_bill_time integer DEFAULT 0; -- rename existing field
  139. ALTER TABLE llx_projet ADD COLUMN usage_organize_event integer DEFAULT 0;
  140. UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0;
  141. create table llx_societe_contacts
  142. (
  143. rowid integer AUTO_INCREMENT PRIMARY KEY,
  144. entity integer DEFAULT 1 NOT NULL,
  145. date_creation datetime NOT NULL,
  146. fk_soc integer NOT NULL,
  147. fk_c_type_contact int NOT NULL,
  148. fk_socpeople integer NOT NULL,
  149. tms TIMESTAMP,
  150. import_key VARCHAR(14)
  151. )ENGINE=innodb;
  152. ALTER TABLE llx_societe_contacts ADD UNIQUE INDEX idx_societe_contacts_idx1 (entity, fk_soc, fk_c_type_contact, fk_socpeople);
  153. ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_c_type_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
  154. ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
  155. ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_socpeople FOREIGN KEY (fk_socpeople) REFERENCES llx_socpeople(rowid);
  156. -- VMYSQL4.3 ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint AUTO_INCREMENT;
  157. -- VPGSQL8.2 ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint;
  158. ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL;
  159. ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL;
  160. create table llx_c_hrm_public_holiday
  161. (
  162. id integer AUTO_INCREMENT PRIMARY KEY,
  163. entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
  164. fk_country integer,
  165. code varchar(62),
  166. dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ...
  167. day integer,
  168. month integer,
  169. year integer, -- 0 for all years
  170. active integer DEFAULT 1,
  171. import_key varchar(14)
  172. )ENGINE=innodb;
  173. ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday(entity, code);
  174. ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday2(entity, fk_country, dayrule, day, month, year);
  175. -- A lot of countries
  176. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('NEWYEARDAY1', 0, 0, 0, 1, 1, 1);
  177. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('LABORDAY1', 0, 0, 0, 5, 1, 1);
  178. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('ASSOMPTIONDAY1', 0, 0, 0, 8, 15, 1);
  179. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('CHRISTMASDAY1', 0, 0, 0, 12, 25, 1);
  180. -- France only (1)
  181. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-VICTORYDAY', 0, 1, '', 0, 5, 8, 1);
  182. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-NATIONALDAY', 0, 1, '', 0, 7, 14, 1);
  183. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASSOMPTION', 0, 1, '', 0, 8, 15, 1);
  184. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-TOUSSAINT', 0, 1, '', 0, 11, 1, 1);
  185. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ARMISTICE', 0, 1, '', 0, 11, 11, 1);
  186. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-EASTER', 0, 1, 'eastermonday', 0, 0, 0, 1);
  187. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASCENSION', 0, 1, 'ascension', 0, 0, 0, 1);
  188. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-PENTECOST', 0, 1, 'pentecost', 0, 0, 0, 1);
  189. -- Italy (3)
  190. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-LIBEAZIONE', 0, 3, 0, 4, 25, 1);
  191. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-EPIPHANY', 0, 3, 0, 6, 1, 1);
  192. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-REPUBBLICA', 0, 3, 0, 6, 2, 1);
  193. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-TUTTISANTIT', 0, 3, 0, 11, 1, 1);
  194. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-IMMACULE', 0, 3, 0, 12, 8, 1);
  195. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-SAINTSTEFAN', 0, 3, 0, 12, 26, 1);
  196. -- Spain (4)
  197. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-EASTER', 0, 4, 'easter', 0, 0, 0, 1);
  198. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-REYE', 0, 4, '', 0, 6, 1, 1);
  199. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-HISPANIDAD', 0, 4, '', 0, 10, 12, 1);
  200. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-TOUSSAINT', 0, 4, '', 0, 11, 1, 1);
  201. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-CONSTITUIZION', 0, 4, '', 0, 12, 6, 1);
  202. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-IMMACULE', 0, 4, '', 0, 12, 8, 1);
  203. -- Austria (41)
  204. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-EASTER', 0, 41, 'eastermonday', 0, 0, 0, 1);
  205. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-ASCENSION', 0, 41, 'ascension', 0, 0, 0, 1);
  206. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-PENTECOST', 0, 41, 'pentecost', 0, 0, 0, 1);
  207. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-FRONLEICHNAM', 0, 41, 'fronleichnam', 0, 0, 0, 1);
  208. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-KONEGIE', 0, 41, '', 0, 6, 1, 1);
  209. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-26OKT', 0, 41, '', 0, 10, 26, 1);
  210. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-TOUSSAINT', 0, 41, '', 0, 11, 1, 1);
  211. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-IMMACULE', 0, 41, '', 0, 12, 8, 1);
  212. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-24DEC', 0, 41, '', 0, 12, 24, 1);
  213. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-SAINTSTEFAN', 0, 41, '', 0, 12, 26, 1);
  214. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-Silvester', 0, 41, '', 0, 12, 31, 1);
  215. -- India (117)
  216. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1);
  217. INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1);
  218. create table llx_c_socialnetworks
  219. (
  220. rowid integer AUTO_INCREMENT PRIMARY KEY,
  221. entity integer DEFAULT 1 NOT NULL,
  222. code varchar(100),
  223. label varchar(150),
  224. url text,
  225. icon varchar(20),
  226. active tinyint DEFAULT 1 NOT NULL
  227. )ENGINE=innodb;
  228. ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
  229. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1);
  230. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1);
  231. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitter', 'Twitter', 'https://www.twitter.com/{socialid}', 'fa-twitter', 1);
  232. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1);
  233. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1);
  234. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1);
  235. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 1);
  236. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1);
  237. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'whatsapp', 'Whatsapp', '{socialid}', 'fa-whatsapp', 1);
  238. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tumblr', 'Tumblr', 'https://www.tumblr.com/{socialid}', 'fa-tumblr', 0);
  239. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vero', 'Vero', 'https://vero.co/{socialid}', '', 0);
  240. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viadeo', 'Viadeo', 'https://fr.viadeo.com/fr/{socialid}', 'fa-viadeo', 0);
  241. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'slack', 'Slack', '{socialid}', 'fa-slack', 0);
  242. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'xing', 'Xing', '{socialid}', 'fa-xing', 0);
  243. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'meetup', 'Meetup', '{socialid}', 'fa-meetup', 0);
  244. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'pinterest', 'Pinterest', '{socialid}', 'fa-pinterest', 0);
  245. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0);
  246. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, '500px', '500px', '{socialid}', 'fa-500px', 0);
  247. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'giphy', 'Giphy', '{socialid}', '', 0);
  248. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'gifycat', 'Gificat', '{socialid}', '', 0);
  249. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'dailymotion', 'Dailymotion', '{socialid}', '', 0);
  250. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vimeo', 'Vimeo', '{socialid}', '', 0);
  251. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'periscope', 'Periscope', '{socialid}', '', 0);
  252. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitch', 'Twitch', '{socialid}', '', 0);
  253. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'discord', 'Discord', '{socialid}', 'fa-discord', 0);
  254. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'wikipedia', 'Wikipedia', '{socialid}', '', 0);
  255. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'reddit', 'Reddit', '{socialid}', 'fa-reddit', 0);
  256. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'quora', 'Quora', '{socialid}', '', 0);
  257. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tripadvisor', 'Tripadvisor', '{socialid}', '', 0);
  258. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'mastodon', 'Mastodon', '{socialid}', '', 0);
  259. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'diaspora', 'Diaspora', '{socialid}', '', 0);
  260. INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viber', 'Viber', '{socialid}', '', 0);
  261. ALTER TABLE llx_adherent ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
  262. ALTER TABLE llx_societe ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
  263. ALTER TABLE llx_socpeople ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
  264. ALTER TABLE llx_user ADD COLUMN socialnetworks text DEFAULT NULL AFTER personal_email;
  265. ALTER TABLE llx_product ADD COLUMN net_measure float;
  266. ALTER TABLE llx_product ADD COLUMN net_measure_units tinyint;
  267. create table llx_adherent_type_lang
  268. (
  269. rowid integer AUTO_INCREMENT PRIMARY KEY,
  270. fk_type integer DEFAULT 0 NOT NULL,
  271. lang varchar(5) DEFAULT 0 NOT NULL,
  272. label varchar(255) NOT NULL,
  273. description text,
  274. email text,
  275. import_key varchar(14) DEFAULT NULL
  276. )ENGINE=innodb;
  277. create table llx_fichinter_rec
  278. (
  279. rowid integer AUTO_INCREMENT PRIMARY KEY,
  280. titre varchar(50) NOT NULL,
  281. entity integer DEFAULT 1 NOT NULL, -- multi company id
  282. fk_soc integer DEFAULT NULL,
  283. datec datetime, -- date de creation
  284. fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
  285. fk_user_author integer, -- createur
  286. fk_projet integer, -- projet auquel est associe la facture
  287. duree real, -- duree totale de l'intervention
  288. description text,
  289. modelpdf varchar(50),
  290. note_private text,
  291. note_public text,
  292. frequency integer, -- frequency (for example: 3 for every 3 month)
  293. unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
  294. date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
  295. date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
  296. nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
  297. nb_gen_max integer DEFAULT NULL, -- maximum number of generation
  298. auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention
  299. )ENGINE=innodb;
  300. ALTER TABLE llx_fichinter_rec ADD UNIQUE INDEX idx_fichinter_rec_uk_titre (titre, entity);
  301. ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_soc (fk_soc);
  302. ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_user_author (fk_user_author);
  303. ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_projet (fk_projet);
  304. ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
  305. ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
  306. create table llx_fichinterdet_rec
  307. (
  308. rowid integer AUTO_INCREMENT PRIMARY KEY,
  309. fk_fichinter integer NOT NULL,
  310. date datetime, -- date de la ligne d'intervention
  311. description text, -- description de la ligne d'intervention
  312. duree integer, -- duree de la ligne d'intervention
  313. rang integer DEFAULT 0, -- ordre affichage sur la fiche
  314. total_ht DOUBLE(24, 8) NULL DEFAULT NULL,
  315. subprice DOUBLE(24, 8) NULL DEFAULT NULL,
  316. fk_parent_line integer NULL DEFAULT NULL,
  317. fk_product integer NULL DEFAULT NULL,
  318. label varchar(255) NULL DEFAULT NULL,
  319. tva_tx DOUBLE(6, 3) NULL DEFAULT NULL,
  320. localtax1_tx DOUBLE(6, 3) NULL DEFAULT 0,
  321. localtax1_type VARCHAR(1) NULL DEFAULT NULL,
  322. localtax2_tx DOUBLE(6, 3) NULL DEFAULT 0,
  323. localtax2_type VARCHAR(1) NULL DEFAULT NULL,
  324. qty double NULL DEFAULT NULL,
  325. remise_percent double NULL DEFAULT 0,
  326. remise double NULL DEFAULT 0,
  327. fk_remise_except integer NULL DEFAULT NULL,
  328. price DOUBLE(24, 8) NULL DEFAULT NULL,
  329. total_tva DOUBLE(24, 8) NULL DEFAULT NULL,
  330. total_localtax1 DOUBLE(24, 8) NULL DEFAULT 0,
  331. total_localtax2 DOUBLE(24, 8) NULL DEFAULT 0,
  332. total_ttc DOUBLE(24, 8) NULL DEFAULT NULL,
  333. product_type INTEGER NULL DEFAULT 0,
  334. date_start datetime NULL DEFAULT NULL,
  335. date_end datetime NULL DEFAULT NULL,
  336. info_bits INTEGER NULL DEFAULT 0,
  337. buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0,
  338. fk_product_fournisseur_price integer NULL DEFAULT NULL,
  339. fk_code_ventilation integer NOT NULL DEFAULT 0,
  340. fk_export_commpta integer NOT NULL DEFAULT 0,
  341. special_code integer UNSIGNED NULL DEFAULT 0,
  342. fk_unit integer NULL DEFAULT NULL,
  343. import_key varchar(14) NULL DEFAULT NULL
  344. )ENGINE=innodb;
  345. ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL AFTER product_type;
  346. ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL AFTER date_start;
  347. --List of parcels details related to an expedition
  348. create table llx_expedition_package
  349. (
  350. rowid integer AUTO_INCREMENT PRIMARY KEY,
  351. fk_expedition integer NOT NULL,
  352. description varchar(255), --Description of goods in the package (required by the custom)
  353. value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom)
  354. fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other)
  355. height float, -- height
  356. width float, -- width
  357. size float, -- depth
  358. size_units integer, -- unit of all sizes (height, width, depth)
  359. weight float, -- weight
  360. weight_units integer, -- unit of weight
  361. dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough.
  362. tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line.
  363. rang integer DEFAULT 0
  364. )ENGINE=innodb;
  365. --Dictionary of package type
  366. create table llx_c_shipment_package_type
  367. (
  368. rowid integer AUTO_INCREMENT PRIMARY KEY,
  369. label varchar(50) NOT NULL, -- Short name
  370. description varchar(255), -- Description
  371. active integer DEFAULT 1 NOT NULL, -- Active or not
  372. entity integer DEFAULT 1 NOT NULL -- Multi company id
  373. )ENGINE=innodb;
  374. CREATE TABLE llx_product_fournisseur_price_extrafields (
  375. rowid integer AUTO_INCREMENT PRIMARY KEY,
  376. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  377. fk_object integer NOT NULL,
  378. import_key varchar(14) -- import key
  379. ) ENGINE=innodb;
  380. ALTER TABLE llx_product_fournisseur_price_extrafields ADD INDEX idx_product_fournisseur_price_extrafields (fk_object);
  381. CREATE TABLE llx_mrp_mo(
  382. -- BEGIN MODULEBUILDER FIELDS
  383. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  384. ref varchar(128) DEFAULT '(PROV)' NOT NULL,
  385. entity integer DEFAULT 1 NOT NULL,
  386. label varchar(255),
  387. qty real NOT NULL,
  388. fk_warehouse integer,
  389. fk_soc integer,
  390. note_public text,
  391. note_private text,
  392. date_creation datetime NOT NULL,
  393. date_valid datetime NULL,
  394. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  395. fk_user_creat integer NOT NULL,
  396. fk_user_modif integer,
  397. fk_user_valid integer,
  398. model_pdf varchar(255),
  399. import_key varchar(14),
  400. status integer NOT NULL,
  401. fk_product integer NOT NULL,
  402. date_start_planned datetime,
  403. date_end_planned datetime,
  404. fk_bom integer,
  405. fk_project integer
  406. -- END MODULEBUILDER FIELDS
  407. ) ENGINE=innodb;
  408. ALTER TABLE llx_mrp_mo ADD COLUMN date_valid datetime NULL;
  409. ALTER TABLE llx_mrp_mo ADD COLUMN fk_user_valid integer;
  410. ALTER TABLE llx_bom_bom ADD COLUMN model_pdf varchar(255);
  411. ALTER TABLE llx_mrp_mo ADD COLUMN model_pdf varchar(255);
  412. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_ref (ref);
  413. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_entity (entity);
  414. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_soc (fk_soc);
  415. ALTER TABLE llx_mrp_mo ADD CONSTRAINT fk_mrp_mo_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
  416. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_status (status);
  417. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_product (fk_product);
  418. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_start_planned (date_start_planned);
  419. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_end_planned (date_end_planned);
  420. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_bom (fk_bom);
  421. ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project);
  422. create table llx_mrp_mo_extrafields
  423. (
  424. rowid integer AUTO_INCREMENT PRIMARY KEY,
  425. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  426. fk_object integer NOT NULL,
  427. import_key varchar(14) -- import key
  428. ) ENGINE=innodb;
  429. ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_fk_object(fk_object);
  430. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650);
  431. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651);
  432. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652);
  433. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653);
  434. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
  435. DELETE FROM llx_c_action_trigger where code LIKE 'MO_%';
  436. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
  437. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
  438. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
  439. insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
  440. ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL;
  441. CREATE TABLE llx_mrp_production(
  442. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  443. fk_mo integer NOT NULL,
  444. position integer NOT NULL DEFAULT 0,
  445. fk_product integer NOT NULL,
  446. fk_warehouse integer,
  447. qty real NOT NULL DEFAULT 1,
  448. qty_frozen smallint DEFAULT 0,
  449. disable_stock_change smallint DEFAULT 0,
  450. batch varchar(30),
  451. role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
  452. fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
  453. fk_stock_movement integer, -- id of stock movement when movements are validated
  454. date_creation datetime NOT NULL,
  455. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  456. fk_user_creat integer NOT NULL,
  457. fk_user_modif integer,
  458. import_key varchar(14)
  459. ) ENGINE=innodb;
  460. ALTER TABLE llx_mrp_production MODIFY COLUMN qty real NOT NULL DEFAULT 1;
  461. ALTER TABLE llx_mrp_production ADD COLUMN qty_frozen smallint DEFAULT 0;
  462. ALTER TABLE llx_mrp_production ADD COLUMN disable_stock_change smallint DEFAULT 0;
  463. ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid);
  464. ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
  465. ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
  466. ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
  467. ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
  468. ALTER TABLE llx_website ADD COLUMN use_manifest integer;
  469. ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEFAULT 1;
  470. create table llx_commande_fournisseur_dispatch_extrafields
  471. (
  472. rowid integer AUTO_INCREMENT PRIMARY KEY,
  473. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  474. fk_object integer NOT NULL, -- object id
  475. import_key varchar(14) -- import key
  476. )ENGINE=innodb;
  477. ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
  478. create table llx_facturedet_rec_extrafields
  479. (
  480. rowid integer AUTO_INCREMENT PRIMARY KEY,
  481. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  482. fk_object integer NOT NULL, -- object id
  483. import_key varchar(14) -- import key
  484. )ENGINE=innodb;
  485. ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object);