Fix: Primary key must be named pk_tablename

This commit is contained in:
Laurent Destailleur 2009-10-17 14:02:15 +00:00
parent c5702c5528
commit 1b7fbc46f9
4 changed files with 11 additions and 6 deletions

View File

@ -132,6 +132,8 @@ ALTER TABLE llx_prelevement_bons ADD COLUMN entity integer DEFAULT 1 NOT NULL AF
ALTER TABLE llx_projet ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY;
ALTER TABLE llx_user_param DROP INDEX fk_user;
ALTER TABLE llx_societe DROP INDEX uk_societe_prefix_comm;
ALTER TABLE llx_societe DROP INDEX uk_societe_code_client;
@ -152,11 +154,13 @@ ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref;
ALTER TABLE llx_livraison DROP INDEX idx_expedition_uk_ref;
ALTER TABLE llx_livraison DROP INDEX idx_livraison_uk_ref;
ALTER TABLE llx_fichinter DROP INDEX ref;
ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY;
ALTER TABLE llx_prelevement_bons DROP INDEX ref;
ALTER TABLE llx_projet DROP INDEX ref;
ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def;
ALTER TABLE llx_rights_def ADD PRIMARY KEY pk_rights_def (id, entity);
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);
ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity);
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_prefix_comm (prefix_comm, entity);
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_code_client (code_client, entity);
@ -178,10 +182,10 @@ ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber,
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 pk_dolibarr_modules (numero, entity);
ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity);
ALTER TABLE llx_prelevement_bons ADD UNIQUE INDEX uk_prelevement_bons_ref (ref, entity);
ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity);
ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity);
ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc);
ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);

View File

@ -1,5 +1,6 @@
-- ============================================================================
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2009 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
@ -19,4 +20,4 @@
-- ===========================================================================
ALTER TABLE llx_boxes_def ADD PRIMARY KEY(rowid, entity);
ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity);

View File

@ -19,4 +19,4 @@
-- ===========================================================================
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY uk_dolibarr_modules (numero, entity);
ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity);

View File

@ -19,4 +19,4 @@
-- ===========================================================================
ALTER TABLE llx_rights_def ADD PRIMARY KEY(id, entity);
ALTER TABLE llx_rights_def ADD PRIMARY KEY pk_rights_def (id, entity);