From be2502c29f2d69db2dea3972c58e1ae4a889afdd Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 28 Apr 2022 10:50:55 +0200 Subject: [PATCH 1/5] New : module webhook database structure --- .../mysql/tables/llx_webhook_target.key.sql | 27 ++++++++++++++ .../mysql/tables/llx_webhook_target.sql | 36 +++++++++++++++++++ .../llx_webhook_target_extrafields.key.sql | 19 ++++++++++ .../tables/llx_webhook_target_extrafields.sql | 23 ++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_webhook_target.key.sql create mode 100644 htdocs/install/mysql/tables/llx_webhook_target.sql create mode 100644 htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql diff --git a/htdocs/install/mysql/tables/llx_webhook_target.key.sql b/htdocs/install/mysql/tables/llx_webhook_target.key.sql new file mode 100644 index 00000000000..04a0dbb306a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_webhook_target.key.sql @@ -0,0 +1,27 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_rowid (rowid); +ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_ref (ref); +ALTER TABLE llx_webhook_target ADD CONSTRAINT llx_webhook_target_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_status (status); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_webhook_target ADD UNIQUE INDEX uk_webhook_target_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_webhook_target ADD CONSTRAINT llx_webhook_target_fk_field FOREIGN KEY (fk_field) REFERENCES llx_webhook_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_webhook_target.sql b/htdocs/install/mysql/tables/llx_webhook_target.sql new file mode 100644 index 00000000000..f9a6b61d489 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_webhook_target.sql @@ -0,0 +1,36 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +CREATE TABLE llx_webhook_target( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + last_main_doc varchar(255), + import_key varchar(14), + model_pdf varchar(255), + status integer NOT NULL, + url varchar(255) NOT NULL, + trigger_codes text NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql new file mode 100644 index 00000000000..c8ebcf12bdc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql @@ -0,0 +1,19 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_webhook_target_extrafields ADD INDEX idx_target_fk_object(fk_object); +-- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql new file mode 100644 index 00000000000..0af3a1fadda --- /dev/null +++ b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_webhook_target_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + From 701960bd70654bf643d07d5c53f829cb175e6d85 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 28 Apr 2022 11:47:13 +0200 Subject: [PATCH 2/5] try to fix build fail --- htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql index 0af3a1fadda..a01ac0e1d1c 100644 --- a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql @@ -16,7 +16,7 @@ create table llx_webhook_target_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; From 2899a6dca5397ee66365b0835f2d948d4c579ce7 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 2 May 2022 10:41:59 +0200 Subject: [PATCH 3/5] fix database files --- ...sql => llx_webhook_target-webhook.key.sql} | 0 ...get.sql => llx_webhook_target-webhook.sql} | 0 .../llx_webhook_target_extrafields.key.sql | 19 --------------- .../tables/llx_webhook_target_extrafields.sql | 23 ------------------- 4 files changed, 42 deletions(-) rename htdocs/install/mysql/tables/{llx_webhook_target.key.sql => llx_webhook_target-webhook.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_webhook_target.sql => llx_webhook_target-webhook.sql} (100%) delete mode 100644 htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql delete mode 100644 htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql diff --git a/htdocs/install/mysql/tables/llx_webhook_target.key.sql b/htdocs/install/mysql/tables/llx_webhook_target-webhook.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_webhook_target.key.sql rename to htdocs/install/mysql/tables/llx_webhook_target-webhook.key.sql diff --git a/htdocs/install/mysql/tables/llx_webhook_target.sql b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_webhook_target.sql rename to htdocs/install/mysql/tables/llx_webhook_target-webhook.sql diff --git a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql deleted file mode 100644 index c8ebcf12bdc..00000000000 --- a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.key.sql +++ /dev/null @@ -1,19 +0,0 @@ --- Copyright (C) ---Put here your own copyright and developer email--- --- --- 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - - --- BEGIN MODULEBUILDER INDEXES -ALTER TABLE llx_webhook_target_extrafields ADD INDEX idx_target_fk_object(fk_object); --- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql b/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql deleted file mode 100644 index a01ac0e1d1c..00000000000 --- a/htdocs/install/mysql/tables/llx_webhook_target_extrafields.sql +++ /dev/null @@ -1,23 +0,0 @@ --- Copyright (C) ---Put here your own copyright and developer email--- --- --- 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -create table llx_webhook_target_extrafields -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key -) ENGINE=innodb; - From 4ea45ac05a59d4e94bbaee8a78e193351453fa8e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 2 May 2022 15:13:42 +0200 Subject: [PATCH 4/5] fix table fields --- htdocs/install/mysql/tables/llx_webhook_target-webhook.sql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql index f9a6b61d489..6d2cd4a771c 100644 --- a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql +++ b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql @@ -17,7 +17,7 @@ CREATE TABLE llx_webhook_target( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) DEFAULT '(PROV)' NOT NULL, + ref varchar(128) NOT NULL, label varchar(255), description text, note_public text, @@ -26,9 +26,7 @@ CREATE TABLE llx_webhook_target( tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, - last_main_doc varchar(255), - import_key varchar(14), - model_pdf varchar(255), + import_key varchar(14), status integer NOT NULL, url varchar(255) NOT NULL, trigger_codes text NOT NULL From 09d02dfbfa303aee22d097031eb392134e8b8361 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 May 2022 01:04:39 +0200 Subject: [PATCH 5/5] Update llx_webhook_target-webhook.sql --- htdocs/install/mysql/tables/llx_webhook_target-webhook.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql index 6d2cd4a771c..1e0cc0fdbac 100644 --- a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql +++ b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql @@ -27,7 +27,7 @@ CREATE TABLE llx_webhook_target( fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), - status integer NOT NULL, + status integer DEFAULT 0 NOT NULL, url varchar(255) NOT NULL, trigger_codes text NOT NULL -- END MODULEBUILDER FIELDS