2
0
forked from Wavyzz/dolibarr

Ajout contrainte unique sur champs unique de users

This commit is contained in:
Laurent Destailleur
2006-08-26 00:25:17 +00:00
parent dacdc58065
commit d0c9050e3d
5 changed files with 41 additions and 9 deletions

View File

@@ -372,6 +372,12 @@ alter table llx_user add column datepreviouslogin datetime after datelastlogin;
alter table llx_user add column ldap_sid varchar(255) DEFAULT NULL;
alter table llx_user add column statut tinyint DEFAULT 1;
alter table llx_user add column lang varchar(6);
alter table llx_user modify login varchar(24) NOT NULL;
alter table llx_user modify code varchar(4) NOT NULL;
ALTER TABLE llx_user ADD UNIQUE uk_user_login (login);
ALTER TABLE llx_user ADD UNIQUE uk_user_code (code);
alter table llx_boxes add column fk_user integer;

View File

@@ -25,13 +25,13 @@
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_soc (fk_soc);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_author (fk_user_author);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_valid (fk_user_valid);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture (fk_facture);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_facture_source (fk_facture_source);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_projet (fk_projet);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_facture_source FOREIGN KEY (fk_facture_source) REFERENCES llx_facture (rowid);
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber);

View File

@@ -0,0 +1,27 @@
-- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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$
-- $Source$
--
-- ===========================================================================
ALTER TABLE llx_user ADD UNIQUE uk_user_login (login);
ALTER TABLE llx_user ADD UNIQUE uk_user_code (code);

View File

@@ -1,5 +1,6 @@
-- ============================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
@@ -25,11 +26,11 @@ create table llx_user
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
tms timestamp,
login varchar(24),
login varchar(24) NOT NULL,
pass varchar(32),
name varchar(50),
firstname varchar(50),
code varchar(4),
code varchar(4) NOT NULL,
office_phone varchar(20),
office_fax varchar(20),
user_mobile varchar(20),
@@ -40,13 +41,11 @@ create table llx_user
module_compta smallint DEFAULT 1,
fk_societe integer DEFAULT 0,
fk_socpeople integer DEFAULT 0,
note text,
note text DEFAULT NULL,
datelastlogin datetime,
datepreviouslogin datetime,
egroupware_id integer,
ldap_sid varchar(255) DEFAULT NULL,
statut tinyint DEFAULT 1,
lang varchar(6),
UNIQUE INDEX(login)
lang varchar(6)
)type=innodb;

View File

@@ -23,7 +23,7 @@
-- Supprimme orhpelins pour permettre mont<6E>e de la cl<63>
--DELETE llx_user_rights FROM llx_user_rights LEFT JOIN llx_user ON llx_user_rights.fk_user = llx_user.rowid WHERE llx_user.rowid IS NULL;
-- V4 DELETE llx_user_rights FROM llx_user_rights LEFT JOIN llx_user ON llx_user_rights.fk_user = llx_user.rowid WHERE llx_user.rowid IS NULL;
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);