From b543207a83c6f0126aaa5cd2e04dcd51a013bdc5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 May 2009 13:08:27 +0000 Subject: [PATCH] Add: all tables with a field ref must contain a field entity --- mysql/migration/2.6.0-2.7.0.sql | 2 ++ mysql/tables/llx_bordereau_cheque.key.sql | 22 ++++++++++++++++++++++ mysql/tables/llx_bordereau_cheque.sql | 3 +++ 3 files changed, 27 insertions(+) create mode 100644 mysql/tables/llx_bordereau_cheque.key.sql diff --git a/mysql/migration/2.6.0-2.7.0.sql b/mysql/migration/2.6.0-2.7.0.sql index df10a7204da..80d5235f529 100644 --- a/mysql/migration/2.6.0-2.7.0.sql +++ b/mysql/migration/2.6.0-2.7.0.sql @@ -52,6 +52,7 @@ ALTER TABLE llx_contrat ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; ALTER TABLE llx_c_barcode_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER code; ALTER TABLE llx_dolibarr_modules ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER numero; ALTER TABLE llx_bank_categ ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER label; +ALTER TABLE llx_bordereau_cheque ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER number; ALTER TABLE llx_rights_def DROP PRIMARY KEY; ALTER TABLE llx_user_param DROP INDEX fk_user; @@ -99,6 +100,7 @@ ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity); ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity); ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity); ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY (numero, entity); +ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX (number, entity); UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_USER' AND entity=1; UPDATE llx_const SET entity=0 WHERE name='MAIN_POPUP_CALENDAR' AND entity=1; diff --git a/mysql/tables/llx_bordereau_cheque.key.sql b/mysql/tables/llx_bordereau_cheque.key.sql new file mode 100644 index 00000000000..80d4eed7ea3 --- /dev/null +++ b/mysql/tables/llx_bordereau_cheque.key.sql @@ -0,0 +1,22 @@ +-- ============================================================================ +-- Copyright (C) 2009 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_bordereau_cheque ADD UNIQUE INDEX (number, entity); diff --git a/mysql/tables/llx_bordereau_cheque.sql b/mysql/tables/llx_bordereau_cheque.sql index bcd9785286d..0316fe1c7ba 100644 --- a/mysql/tables/llx_bordereau_cheque.sql +++ b/mysql/tables/llx_bordereau_cheque.sql @@ -1,5 +1,6 @@ -- =================================================================== -- Copyright (C) 2006 Rodolphe Quiedeville +-- Copyright (C) 2009 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 @@ -28,10 +29,12 @@ create table llx_bordereau_cheque datec datetime NOT NULL, date_bordereau date, -- A quoi sert cette date ? number varchar(16) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id amount double(24,8) NOT NULL, nbcheque smallint NOT NULL, fk_bank_account integer, fk_user_author integer, note text, statut smallint(1) NOT NULL DEFAULT 0 + )type=innodb;