diff --git a/dev/dbmodel/dolibarr_schema.mwb b/dev/dbmodel/dolibarr_schema.mwb index e36c7b0c8af..8b025f6217e 100644 Binary files a/dev/dbmodel/dolibarr_schema.mwb and b/dev/dbmodel/dolibarr_schema.mwb differ diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql index 9ed838f06e6..c4ae0a983d1 100755 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql @@ -38,6 +38,38 @@ create table llx_product_variant_lang ALTER TABLE llx_product_variant_lang ADD UNIQUE INDEX uk_product_variant_lang (fk_product_variant, lang); ALTER TABLE llx_product_variant_lang ADD CONSTRAINT fk_product_variant_lang_fk_product_variant FOREIGN KEY (fk_product_variant) REFERENCES llx_product_variant (rowid); +create table llx_product_variant_values +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_product_variant integer NOT NULL, + active tinyint DEFAULT 1 NOT NULL, + rang integer DEFAULT 0 +)type=innodb; + +ALTER TABLE llx_product_variant_values ADD UNIQUE INDEX idx_product_variant_values_fk_product_variant (fk_product_variant); +ALTER TABLE llx_product_variant_values ADD CONSTRAINT fk_product_variant_values_fk_product_variant FOREIGN KEY (fk_product_variant) REFERENCES llx_product_variant (rowid); + +create table llx_product_variant_values_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_product_variant_values integer DEFAULT 0 NOT NULL, + lang varchar(5) NOT NULL, + label varchar(64) NOT NULL +)type=innodb; + +ALTER TABLE llx_product_variant_values_lang ADD UNIQUE INDEX uk_product_variant_values_lang (fk_product_variant_values, lang); +ALTER TABLE llx_product_variant_values_lang ADD CONSTRAINT fk_product_variant_values_lang_fk_product_variant_values FOREIGN KEY (fk_product_variant_values) REFERENCES llx_product_variant_values (rowid); + +create table llx_product_variant_combination +( + fk_product integer PRIMARY KEY, + fk_product_variant_values integer DEFAULT 0 NOT NULL +)type=innodb; + +ALTER TABLE llx_product_variant_combination ADD INDEX idx_product_variant_values_fk_product (fk_product, fk_product_variant_values); +ALTER TABLE llx_product_variant_combination ADD CONSTRAINT fk_product_variant_combination_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_variant_combination ADD CONSTRAINT fk_product_variant_combination_fk_product_variant_values FOREIGN KEY (fk_product_variant_values) REFERENCES llx_product_variant_values (rowid); alter table llx_societe add column default_lang varchar(6) after price_level; alter table llx_socpeople add column default_lang varchar(6) after note; diff --git a/htdocs/install/mysql/tables/llx_product_variant_combination.key.sql b/htdocs/install/mysql/tables/llx_product_variant_combination.key.sql new file mode 100644 index 00000000000..665f0fd39e4 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_combination.key.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + + +ALTER TABLE llx_product_variant_combination ADD INDEX idx_product_variant_values_fk_product (fk_product, fk_product_variant_values); + + +ALTER TABLE llx_product_variant_combination ADD CONSTRAINT fk_product_variant_combination_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_variant_combination ADD CONSTRAINT fk_product_variant_combination_fk_product_variant_values FOREIGN KEY (fk_product_variant_values) REFERENCES llx_product_variant_values (rowid); diff --git a/htdocs/install/mysql/tables/llx_product_variant_combination.sql b/htdocs/install/mysql/tables/llx_product_variant_combination.sql new file mode 100644 index 00000000000..265d6dcb379 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_combination.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + +create table llx_product_variant_combination +( + fk_product integer PRIMARY KEY, + fk_product_variant_values integer DEFAULT 0 NOT NULL +)type=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_variant_values.key.sql b/htdocs/install/mysql/tables/llx_product_variant_values.key.sql new file mode 100644 index 00000000000..aebd2febcd3 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_values.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + + +ALTER TABLE llx_product_variant_values ADD UNIQUE INDEX idx_product_variant_values_fk_product_variant (fk_product_variant); + + +ALTER TABLE llx_product_variant_values ADD CONSTRAINT fk_product_variant_values_fk_product_variant FOREIGN KEY (fk_product_variant) REFERENCES llx_product_variant (rowid); diff --git a/htdocs/install/mysql/tables/llx_product_variant_values.sql b/htdocs/install/mysql/tables/llx_product_variant_values.sql new file mode 100644 index 00000000000..6292be6134a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_values.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + +create table llx_product_variant_values +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_product_variant integer NOT NULL, + active tinyint DEFAULT 1 NOT NULL, + rang integer DEFAULT 0 +)type=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_variant_values_lang.key.sql b/htdocs/install/mysql/tables/llx_product_variant_values_lang.key.sql new file mode 100644 index 00000000000..d4e50183b79 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_values_lang.key.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + + +ALTER TABLE llx_product_variant_values_lang ADD UNIQUE INDEX uk_product_variant_values_lang (fk_product_variant_values, lang); + + +ALTER TABLE llx_product_variant_values_lang ADD CONSTRAINT fk_product_variant_values_lang_fk_product_variant_values FOREIGN KEY (fk_product_variant_values) REFERENCES llx_product_variant_values (rowid); + diff --git a/htdocs/install/mysql/tables/llx_product_variant_values_lang.sql b/htdocs/install/mysql/tables/llx_product_variant_values_lang.sql new file mode 100644 index 00000000000..70b28a938b5 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_variant_values_lang.sql @@ -0,0 +1,27 @@ +-- ============================================================================ +-- Copyright (C) 2010 Regis Houssin +-- +-- 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 2 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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- ============================================================================ + +create table llx_product_variant_values_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_product_variant_values integer DEFAULT 0 NOT NULL, + lang varchar(5) NOT NULL, + label varchar(64) NOT NULL +)type=innodb;