From 75f579c3ad88a9eea3529bbd5808545ec908321b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 22 Oct 2021 00:59:09 +0200 Subject: [PATCH 1/3] New table element_tag --- .../mysql/tables/llx_element_tag.key.sql | 23 ++++++++++++++++++ .../install/mysql/tables/llx_element_tag.sql | 24 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_element_tag.key.sql create mode 100644 htdocs/install/mysql/tables/llx_element_tag.sql diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql new file mode 100644 index 00000000000..fc1e3e7861d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -0,0 +1,23 @@ +-- ============================================================================ +-- Copyright (C) 2021 Maxime Kohlhaas +-- +-- 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 . +-- +-- ============================================================================ + +ALTER TABLE llx_element_tag ADD PRIMARY KEY pk_element_tag (fk_categorie, fk_socpeople); +ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_categorie (fk_categorie); +ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_socpeople (fk_socpeople); + +ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql new file mode 100644 index 00000000000..937137727e7 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.sql @@ -0,0 +1,24 @@ +-- ============================================================================ +-- Copyright (C) 2021 Maxime Kohlhaas +-- +-- 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 . +-- +-- ============================================================================ + +create table llx_element_tag +( + fk_categorie integer NOT NULL, + fk_element integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; From d4107fcc4e324267ed872f7f4da07c123c01ba80 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 31 Oct 2021 16:14:13 +0100 Subject: [PATCH 2/3] Fix wrong column name --- htdocs/install/mysql/tables/llx_element_tag.key.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql index fc1e3e7861d..e4af1c3871e 100644 --- a/htdocs/install/mysql/tables/llx_element_tag.key.sql +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -16,8 +16,8 @@ -- -- ============================================================================ -ALTER TABLE llx_element_tag ADD PRIMARY KEY pk_element_tag (fk_categorie, fk_socpeople); +ALTER TABLE llx_element_tag ADD PRIMARY KEY pk_element_tag (fk_categorie, fk_element); ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_categorie (fk_categorie); -ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_socpeople (fk_socpeople); +ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_element (fk_element); ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); From 3508aa92d6bcc20d6f7e2d5fefe15cef6ceaacd4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 1 Nov 2021 10:24:19 +0100 Subject: [PATCH 3/3] Fix : uk and index on element_tag table --- htdocs/install/mysql/tables/llx_element_tag.key.sql | 4 +--- htdocs/install/mysql/tables/llx_element_tag.sql | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql index e4af1c3871e..d3a0b38afa9 100644 --- a/htdocs/install/mysql/tables/llx_element_tag.key.sql +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -16,8 +16,6 @@ -- -- ============================================================================ -ALTER TABLE llx_element_tag ADD PRIMARY KEY pk_element_tag (fk_categorie, fk_element); -ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_categorie (fk_categorie); -ALTER TABLE llx_element_tag ADD INDEX idx_element_tag_fk_element (fk_element); +ALTER TABLE llx_element_tag ADD UNIQUE INDEX idx_element_tag_uk (fk_categorie, fk_element); ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql index 937137727e7..d43ced98130 100644 --- a/htdocs/install/mysql/tables/llx_element_tag.sql +++ b/htdocs/install/mysql/tables/llx_element_tag.sql @@ -18,6 +18,7 @@ create table llx_element_tag ( + rowid integer AUTO_INCREMENT PRIMARY KEY, fk_categorie integer NOT NULL, fk_element integer NOT NULL, import_key varchar(14)