From 261d9c63fcc6151aaa89069e61d757f0dd894ef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Mar 2005 22:43:16 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Le=20nom=20des=20index=20g=E9n=E9r=E9s?= =?UTF-8?q?=20pour=20pgsql=20inclus=20la=20table=20car=20sous=20pgsql=20on?= =?UTF-8?q?=20un=20nom=20d'index=20doit=20etre=20unique=20pour=20toute=20l?= =?UTF-8?q?a=20base=20(sous=20mysql,=20unique=20par=20table)=20Fix:=20Corr?= =?UTF-8?q?ige=20probl=E8me=20de=20quot=20sur=20UNIQUE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pgsql/tables/llx_adherent.sql | 5 +++-- pgsql/tables/llx_adherent_options.sql | 5 +++-- pgsql/tables/llx_album_to_groupart.sql | 3 ++- pgsql/tables/llx_bank_class.sql | 2 +- pgsql/tables/llx_bookmark4u_login.sql | 5 +++-- pgsql/tables/llx_c_ape.sql | 5 +++-- pgsql/tables/llx_c_departements.sql | 2 +- pgsql/tables/llx_co_fa.sql | 4 ++-- pgsql/tables/llx_commande.sql | 5 +++-- pgsql/tables/llx_commande_fournisseur.sql | 5 +++-- pgsql/tables/llx_compta_compte_generaux.sql | 4 +++- pgsql/tables/llx_const.sql | 5 +++-- pgsql/tables/llx_contact_facture.sql | 4 +++- pgsql/tables/llx_expedition.sql | 9 +++++---- pgsql/tables/llx_expeditiondet.sql | 4 ++-- pgsql/tables/llx_facture.sql | 5 +++-- pgsql/tables/llx_facture_fourn.sql | 3 ++- pgsql/tables/llx_facture_rec.sql | 2 +- pgsql/tables/llx_fichinter.sql | 5 +++-- pgsql/tables/llx_livre.sql | 5 +++-- pgsql/tables/llx_livre_to_auteur.sql | 3 ++- pgsql/tables/llx_paiement_facture.sql | 4 ++-- pgsql/tables/llx_prelevement.sql | 4 +++- pgsql/tables/llx_prelevement_bons.sql | 4 +++- pgsql/tables/llx_product_fournisseur.sql | 4 ++-- pgsql/tables/llx_product_stock.sql | 4 ++-- pgsql/tables/llx_projet.sql | 5 +++-- pgsql/tables/llx_propal.sql | 5 +++-- pgsql/tables/llx_so_gr.sql | 4 +++- pgsql/tables/llx_societe.sql | 5 +++-- pgsql/tables/llx_societe_commerciaux.sql | 3 ++- pgsql/tables/llx_stock_mouvement.sql | 4 ++-- pgsql/tables/llx_user.sql | 5 +++-- pgsql/tables/llx_user_param.sql | 4 +++- pgsql/tables/llx_user_rights.sql | 3 ++- pgsql/tables/llx_usergroup_rights.sql | 4 +++- pgsql/tables/llx_usergroup_user.sql | 4 +++- 37 files changed, 96 insertions(+), 60 deletions(-) diff --git a/pgsql/tables/llx_adherent.sql b/pgsql/tables/llx_adherent.sql index 5664ba9267b..670ea549381 100644 --- a/pgsql/tables/llx_adherent.sql +++ b/pgsql/tables/llx_adherent.sql @@ -55,8 +55,9 @@ create table llx_adherent "fk_user_mod" integer NOT NULL, "fk_user_valid" integer NOT NULL, "datefin" timestamp, -- date de fin de validité de la cotisation - "note" text + "note" text, + UNIQUE(login) ); -CREATE INDEX idx_login ON llx_adherent (login); +CREATE INDEX idx_llx_adherent_login ON llx_adherent (login); diff --git a/pgsql/tables/llx_adherent_options.sql b/pgsql/tables/llx_adherent_options.sql index 930713f6417..16401ff1dc1 100644 --- a/pgsql/tables/llx_adherent_options.sql +++ b/pgsql/tables/llx_adherent_options.sql @@ -30,7 +30,8 @@ create table llx_adherent_options ( optid SERIAL PRIMARY KEY, "tms" timestamp, - "adhid" integer NOT NULL -- id de l'adherent auquel correspond ces attributs optionnel + "adhid" integer NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel + UNIQUE(adhid) ); -CREATE INDEX idx_adhid ON llx_adherent_options (adhid); +CREATE INDEX idx_llx_adherent_options_adhid ON llx_adherent_options (adhid); diff --git a/pgsql/tables/llx_album_to_groupart.sql b/pgsql/tables/llx_album_to_groupart.sql index 5a84ea6ca64..b5258099155 100644 --- a/pgsql/tables/llx_album_to_groupart.sql +++ b/pgsql/tables/llx_album_to_groupart.sql @@ -28,6 +28,7 @@ create table llx_album_to_groupart ( "fk_album" integer NOT NULL, - "fk_groupart" integer NOT NULL + "fk_groupart" integer NOT NULL, + UNIQUE(fk_album, fk_groupart) ); diff --git a/pgsql/tables/llx_bank_class.sql b/pgsql/tables/llx_bank_class.sql index c6804e8995b..1a7c575e3d2 100644 --- a/pgsql/tables/llx_bank_class.sql +++ b/pgsql/tables/llx_bank_class.sql @@ -29,4 +29,4 @@ create table llx_bank_class "fk_categ" integer NOT NULL ); -CREATE INDEX idx_lineid ON llx_bank_class (lineid); +CREATE INDEX idx_llx_bank_class_lineid ON llx_bank_class (lineid); diff --git a/pgsql/tables/llx_bookmark4u_login.sql b/pgsql/tables/llx_bookmark4u_login.sql index 636a92b290f..ad67ec77ecc 100644 --- a/pgsql/tables/llx_bookmark4u_login.sql +++ b/pgsql/tables/llx_bookmark4u_login.sql @@ -29,7 +29,8 @@ create table llx_bookmark4u_login ( rowid SERIAL PRIMARY KEY, "fk_user" integer, - "bk4u_uid" integer + "bk4u_uid" integer, + UNIQUE(fk_user) ); -CREATE INDEX idx_fk_user ON llx_bookmark4u_login (fk_user); +CREATE INDEX idx_llx_bookmark4u_login_fk_user ON llx_bookmark4u_login (fk_user); diff --git a/pgsql/tables/llx_c_ape.sql b/pgsql/tables/llx_c_ape.sql index 1aed38ea03b..abca17e00ed 100644 --- a/pgsql/tables/llx_c_ape.sql +++ b/pgsql/tables/llx_c_ape.sql @@ -31,8 +31,9 @@ create table llx_c_ape rowid SERIAL PRIMARY KEY, "code_ape" varchar(5) NOT NULL, "libelle" varchar(255), - "active" smallint DEFAULT 1 NOT NULL + "active" smallint DEFAULT 1 NOT NULL, + UNIQUE(code_ape) ); -CREATE INDEX idx_code_ape ON llx_c_ape (code_ape); +CREATE INDEX idx_llx_c_ape_code_ape ON llx_c_ape (code_ape); diff --git a/pgsql/tables/llx_c_departements.sql b/pgsql/tables/llx_c_departements.sql index eb5f443dbeb..fed2ec4875a 100644 --- a/pgsql/tables/llx_c_departements.sql +++ b/pgsql/tables/llx_c_departements.sql @@ -38,7 +38,7 @@ create table llx_c_departements "active" smallint DEFAULT 1 NOT NULL ); -CREATE INDEX idx_fk_region ON llx_c_departements (fk_region); +CREATE INDEX idx_llx_c_departements_fk_region ON llx_c_departements (fk_region); diff --git a/pgsql/tables/llx_co_fa.sql b/pgsql/tables/llx_co_fa.sql index 10b41ba0dec..bf081315f6a 100644 --- a/pgsql/tables/llx_co_fa.sql +++ b/pgsql/tables/llx_co_fa.sql @@ -31,5 +31,5 @@ create table llx_co_fa "fk_facture" integer NOT NULL ); -CREATE INDEX idx_fk_commande ON llx_co_fa (fk_commande); -CREATE INDEX idx_fk_facture ON llx_co_fa (fk_facture); +CREATE INDEX idx_llx_co_fa_fk_commande ON llx_co_fa (fk_commande); +CREATE INDEX idx_llx_co_fa_fk_facture ON llx_co_fa (fk_facture); diff --git a/pgsql/tables/llx_commande.sql b/pgsql/tables/llx_commande.sql index 93c4d65ca55..74d6d9b8a2b 100644 --- a/pgsql/tables/llx_commande.sql +++ b/pgsql/tables/llx_commande.sql @@ -49,7 +49,8 @@ create table llx_commande "total_ttc" real default 0, "note" text, "model_pdf" varchar(50), - "facture" smallint default 0 + "facture" smallint default 0, + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_commande (ref); +CREATE INDEX idx_llx_commande_ref ON llx_commande (ref); diff --git a/pgsql/tables/llx_commande_fournisseur.sql b/pgsql/tables/llx_commande_fournisseur.sql index 382bd52c672..d026b00c134 100644 --- a/pgsql/tables/llx_commande_fournisseur.sql +++ b/pgsql/tables/llx_commande_fournisseur.sql @@ -50,7 +50,8 @@ create table llx_commande_fournisseur "total_ht" real default 0, "total_ttc" real default 0, "note" text, - "model_pdf" varchar(50) + "model_pdf" varchar(50), + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_commande_fournisseur (ref); +CREATE INDEX idx_llx_commande_fournisseur_ref ON llx_commande_fournisseur (ref); diff --git a/pgsql/tables/llx_compta_compte_generaux.sql b/pgsql/tables/llx_compta_compte_generaux.sql index 9fc2a14bbce..7336b46c540 100644 --- a/pgsql/tables/llx_compta_compte_generaux.sql +++ b/pgsql/tables/llx_compta_compte_generaux.sql @@ -33,5 +33,7 @@ create table llx_compta_compte_generaux "intitule" varchar(255), "fk_user_author" integer, "note" text, - "UNIQUE"(numero) + UNIQUE(numero) ); + +CREATE INDEX idx_llx_compta_compte_generaux_numero ON llx_compta_compte_generaux (numero); diff --git a/pgsql/tables/llx_const.sql b/pgsql/tables/llx_const.sql index fa2e0f1a6ab..90adee93c61 100644 --- a/pgsql/tables/llx_const.sql +++ b/pgsql/tables/llx_const.sql @@ -36,7 +36,8 @@ create table llx_const "value" text, -- max 65535 caracteres "type" varchar(6) CHECK (type IN ('yesno','texte','chaine')) , "visible" smallint DEFAULT 1 NOT NULL, - "note" text + "note" text, + UNIQUE(name) ); -CREATE INDEX idx_name ON llx_const (name); +CREATE INDEX idx_llx_const_name ON llx_const (name); diff --git a/pgsql/tables/llx_contact_facture.sql b/pgsql/tables/llx_contact_facture.sql index 555415f59f6..31e12c8500c 100644 --- a/pgsql/tables/llx_contact_facture.sql +++ b/pgsql/tables/llx_contact_facture.sql @@ -32,5 +32,7 @@ create table llx_contact_facture idp SERIAL PRIMARY KEY, "fk_soc" integer NOT NULL, "fk_contact" integer NOT NULL, -- point sur llx_socpeople - "UNIQUE" (fk_soc, fk_contact) + UNIQUE(fk_soc, fk_contact) ); + +CREATE INDEX idx_llx_contact_facture_fk_soc__fk_contact ON llx_contact_facture (); diff --git a/pgsql/tables/llx_expedition.sql b/pgsql/tables/llx_expedition.sql index c07a7d7fe46..2f187f22840 100644 --- a/pgsql/tables/llx_expedition.sql +++ b/pgsql/tables/llx_expedition.sql @@ -40,9 +40,10 @@ create table llx_expedition "fk_expedition_methode" integer, "fk_statut" smallint DEFAULT 0, "note" text, - "model_pdf" varchar(50) + "model_pdf" varchar(50), + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_expedition (ref); -CREATE INDEX idx_fk_expedition_methode ON llx_expedition (fk_expedition_methode); -CREATE INDEX idx_fk_commande ON llx_expedition (fk_commande); +CREATE INDEX idx_llx_expedition_ref ON llx_expedition (ref); +CREATE INDEX idx_llx_expedition_fk_expedition_methode ON llx_expedition (fk_expedition_methode); +CREATE INDEX idx_llx_expedition_fk_commande ON llx_expedition (fk_commande); diff --git a/pgsql/tables/llx_expeditiondet.sql b/pgsql/tables/llx_expeditiondet.sql index 6ed14125135..c2d768160d2 100644 --- a/pgsql/tables/llx_expeditiondet.sql +++ b/pgsql/tables/llx_expeditiondet.sql @@ -32,5 +32,5 @@ create table llx_expeditiondet "qty" real -- quantité ); -CREATE INDEX idx_fk_expedition ON llx_expeditiondet (fk_expedition); -CREATE INDEX idx_fk_commande_ligne ON llx_expeditiondet (fk_commande_ligne); +CREATE INDEX idx_llx_expeditiondet_fk_expedition ON llx_expeditiondet (fk_expedition); +CREATE INDEX idx_llx_expeditiondet_fk_commande_ligne ON llx_expeditiondet (fk_commande_ligne); diff --git a/pgsql/tables/llx_facture.sql b/pgsql/tables/llx_facture.sql index c56f422ff15..9c8c826e9ab 100644 --- a/pgsql/tables/llx_facture.sql +++ b/pgsql/tables/llx_facture.sql @@ -48,8 +48,9 @@ create table llx_facture "fk_cond_reglement" integer, -- condition de reglement (30 jours, fin de mois ...) "fk_mode_reglement" integer, -- mode de reglement (Virement, Prélèvement) "date_lim_reglement" date, -- date limite de reglement - "note" text + "note" text, + UNIQUE(facnumber) ); -CREATE INDEX idx_facnumber ON llx_facture (facnumber); +CREATE INDEX idx_llx_facture_facnumber ON llx_facture (facnumber); CREATE INDEX fksoc ON llx_facture (fk_soc); diff --git a/pgsql/tables/llx_facture_fourn.sql b/pgsql/tables/llx_facture_fourn.sql index 23186c0116f..c72623000e3 100644 --- a/pgsql/tables/llx_facture_fourn.sql +++ b/pgsql/tables/llx_facture_fourn.sql @@ -47,5 +47,6 @@ create table llx_facture_fourn "fk_statut" smallint DEFAULT 0 NOT NULL, "fk_user_author" integer, -- createur de la facture "fk_user_valid" integer, -- valideur de la facture - "note" text + "note" text, + UNIQUE(facnumber, fk_soc) ); diff --git a/pgsql/tables/llx_facture_rec.sql b/pgsql/tables/llx_facture_rec.sql index 0821b02a995..7a2136ce6b9 100644 --- a/pgsql/tables/llx_facture_rec.sql +++ b/pgsql/tables/llx_facture_rec.sql @@ -45,4 +45,4 @@ create table llx_facture_rec "note" text ); -CREATE INDEX fksoc ON llx_facture_rec (fk_soc); +CREATE INDEX idx_facture_rec_fksoc ON llx_facture_rec (fk_soc); diff --git a/pgsql/tables/llx_fichinter.sql b/pgsql/tables/llx_fichinter.sql index d4824d9648b..378a8a313d1 100644 --- a/pgsql/tables/llx_fichinter.sql +++ b/pgsql/tables/llx_fichinter.sql @@ -38,7 +38,8 @@ create table llx_fichinter "fk_user_valid" integer, -- valideur de la fiche "fk_statut" smallint DEFAULT 0, "duree" real, - "note" text + "note" text, + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_fichinter (ref); +CREATE INDEX idx_llx_fichinter_ref ON llx_fichinter (ref); diff --git a/pgsql/tables/llx_livre.sql b/pgsql/tables/llx_livre.sql index 8aac4b5c6d2..56239d2ed1e 100644 --- a/pgsql/tables/llx_livre.sql +++ b/pgsql/tables/llx_livre.sql @@ -39,8 +39,9 @@ create table llx_livre "prix" decimal(15,4), "fk_editeur" integer, "fk_user_author" integer, - "frais_de_port" smallint DEFAULT 1 + "frais_de_port" smallint DEFAULT 1, + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_livre (ref); +CREATE INDEX idx_llx_livre_ref ON llx_livre (ref); diff --git a/pgsql/tables/llx_livre_to_auteur.sql b/pgsql/tables/llx_livre_to_auteur.sql index 8c61d96b32b..14064501faf 100644 --- a/pgsql/tables/llx_livre_to_auteur.sql +++ b/pgsql/tables/llx_livre_to_auteur.sql @@ -28,5 +28,6 @@ create table llx_livre_to_auteur ( "fk_livre" integer NOT NULL, - "fk_auteur" integer NOT NULL + "fk_auteur" integer NOT NULL, + UNIQUE(fk_livre, fk_auteur) ); diff --git a/pgsql/tables/llx_paiement_facture.sql b/pgsql/tables/llx_paiement_facture.sql index a197790b6ec..dfbe0bb8486 100644 --- a/pgsql/tables/llx_paiement_facture.sql +++ b/pgsql/tables/llx_paiement_facture.sql @@ -33,5 +33,5 @@ create table llx_paiement_facture ); -CREATE INDEX idx_fk_paiement ON llx_paiement_facture (fk_paiement); -CREATE INDEX idx_fk_facture ON llx_paiement_facture (fk_facture); +CREATE INDEX idx_llx_paiement_facture_fk_paiement ON llx_paiement_facture (fk_paiement); +CREATE INDEX idx_llx_paiement_facture_fk_facture ON llx_paiement_facture (fk_facture); diff --git a/pgsql/tables/llx_prelevement.sql b/pgsql/tables/llx_prelevement.sql index cde4d3f090a..5e78a8b05f7 100644 --- a/pgsql/tables/llx_prelevement.sql +++ b/pgsql/tables/llx_prelevement.sql @@ -41,5 +41,7 @@ create table llx_prelevement "date_credit" timestamp, "fk_user_credit" integer, - "UNIQUE"(ref) + UNIQUE(ref) ); + +CREATE INDEX idx_llx_prelevement_ref ON llx_prelevement (ref); diff --git a/pgsql/tables/llx_prelevement_bons.sql b/pgsql/tables/llx_prelevement_bons.sql index 0d0f000a227..6463e12a8a4 100644 --- a/pgsql/tables/llx_prelevement_bons.sql +++ b/pgsql/tables/llx_prelevement_bons.sql @@ -43,5 +43,7 @@ create table llx_prelevement_bons "date_credit" timestamp, -- date de crédit sur le compte "fk_user_credit" integer, -- user qui a remonté l'info de crédit - "UNIQUE"(ref) + UNIQUE(ref) ); + +CREATE INDEX idx_llx_prelevement_bons_ref ON llx_prelevement_bons (ref); diff --git a/pgsql/tables/llx_product_fournisseur.sql b/pgsql/tables/llx_product_fournisseur.sql index fd024ede4f7..8e64e11bb3d 100644 --- a/pgsql/tables/llx_product_fournisseur.sql +++ b/pgsql/tables/llx_product_fournisseur.sql @@ -36,6 +36,6 @@ create table llx_product_fournisseur "fk_user_author" integer ); -CREATE INDEX idx_fk_product ON llx_product_fournisseur (fk_product); -CREATE INDEX idx_fk_soc ON llx_product_fournisseur (fk_soc); +CREATE INDEX idx_llx_product_fournisseur_fk_product ON llx_product_fournisseur (fk_product); +CREATE INDEX idx_llx_product_fournisseur_fk_soc ON llx_product_fournisseur (fk_soc); diff --git a/pgsql/tables/llx_product_stock.sql b/pgsql/tables/llx_product_stock.sql index 3f9c600d9d4..cfe82c46686 100644 --- a/pgsql/tables/llx_product_stock.sql +++ b/pgsql/tables/llx_product_stock.sql @@ -34,6 +34,6 @@ create table llx_product_stock "reel" integer -- stock réel ); -CREATE INDEX idx_fk_product ON llx_product_stock (fk_product); -CREATE INDEX idx_fk_entrepot ON llx_product_stock (fk_entrepot); +CREATE INDEX idx_llx_product_stock_fk_product ON llx_product_stock (fk_product); +CREATE INDEX idx_llx_product_stock_fk_entrepot ON llx_product_stock (fk_entrepot); diff --git a/pgsql/tables/llx_projet.sql b/pgsql/tables/llx_projet.sql index 1299cade4d6..d7ba9046e9a 100644 --- a/pgsql/tables/llx_projet.sql +++ b/pgsql/tables/llx_projet.sql @@ -37,7 +37,8 @@ create table llx_projet "title" varchar(255), "fk_user_resp" integer, -- responsable du projet "fk_user_creat" integer, -- createur du projet - "note" text + "note" text, + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_projet (ref); +CREATE INDEX idx_llx_projet_ref ON llx_projet (ref); diff --git a/pgsql/tables/llx_propal.sql b/pgsql/tables/llx_propal.sql index 510ca104aa5..61db2c47a6f 100644 --- a/pgsql/tables/llx_propal.sql +++ b/pgsql/tables/llx_propal.sql @@ -46,7 +46,8 @@ create table llx_propal "tva" real DEFAULT 0, "total" real DEFAULT 0, "note" text, - "model_pdf" varchar(50) + "model_pdf" varchar(50), + UNIQUE(ref) ); -CREATE INDEX idx_ref ON llx_propal (ref); +CREATE INDEX idx_llx_propal_ref ON llx_propal (ref); diff --git a/pgsql/tables/llx_so_gr.sql b/pgsql/tables/llx_so_gr.sql index 46d4a8d80c0..330dc3f810f 100644 --- a/pgsql/tables/llx_so_gr.sql +++ b/pgsql/tables/llx_so_gr.sql @@ -32,5 +32,7 @@ create table llx_so_gr rowid SERIAL PRIMARY KEY, "fk_soc" integer, "fk_groupe" integer, - "UNIQUE"(fk_soc, fk_groupe) + UNIQUE(fk_soc, fk_groupe) ); + +CREATE INDEX idx_llx_so_gr_fk_soc__fk_groupe ON llx_so_gr (); diff --git a/pgsql/tables/llx_societe.sql b/pgsql/tables/llx_societe.sql index 7de0d3bee99..68caa9da578 100644 --- a/pgsql/tables/llx_societe.sql +++ b/pgsql/tables/llx_societe.sql @@ -64,8 +64,9 @@ create table llx_societe "rubrique" varchar(255), -- champ rubrique libre "fk_user_creat" integer, -- utilisateur qui a créé l'info "fk_user_modif" integer, -- utilisateur qui a modifié l'info - "remise_client" real DEFAULT 0 -- remise systématique pour le client + "remise_client" real DEFAULT 0, -- remise systématique pour le client + UNIQUE(prefix_comm) ); -CREATE INDEX idx_prefix_comm ON llx_societe (prefix_comm); +CREATE INDEX idx_llx_societe_prefix_comm ON llx_societe (prefix_comm); diff --git a/pgsql/tables/llx_societe_commerciaux.sql b/pgsql/tables/llx_societe_commerciaux.sql index 34395529776..918b249ebe2 100644 --- a/pgsql/tables/llx_societe_commerciaux.sql +++ b/pgsql/tables/llx_societe_commerciaux.sql @@ -29,6 +29,7 @@ create table llx_societe_commerciaux ( rowid SERIAL PRIMARY KEY, "fk_soc" integer, - "fk_user" integer + "fk_user" integer, + UNIQUE(fk_soc, fk_user) ); diff --git a/pgsql/tables/llx_stock_mouvement.sql b/pgsql/tables/llx_stock_mouvement.sql index 4a2f950e3b8..3341d3e6b25 100644 --- a/pgsql/tables/llx_stock_mouvement.sql +++ b/pgsql/tables/llx_stock_mouvement.sql @@ -37,6 +37,6 @@ create table llx_stock_mouvement "fk_user_author" integer ); -CREATE INDEX idx_fk_product ON llx_stock_mouvement (fk_product); -CREATE INDEX idx_fk_entrepot ON llx_stock_mouvement (fk_entrepot); +CREATE INDEX idx_llx_stock_mouvement_fk_product ON llx_stock_mouvement (fk_product); +CREATE INDEX idx_llx_stock_mouvement_fk_entrepot ON llx_stock_mouvement (fk_entrepot); diff --git a/pgsql/tables/llx_user.sql b/pgsql/tables/llx_user.sql index 26e985c421c..c9cbb44aa91 100644 --- a/pgsql/tables/llx_user.sql +++ b/pgsql/tables/llx_user.sql @@ -42,7 +42,8 @@ create table llx_user "module_compta" smallint DEFAULT 1, "fk_societe" integer DEFAULT 0, "fk_socpeople" integer DEFAULT 0, - "note" text + "note" text, + UNIQUE(login) ); -CREATE INDEX idx_login ON llx_user (login); +CREATE INDEX idx_llx_user_login ON llx_user (login); diff --git a/pgsql/tables/llx_user_param.sql b/pgsql/tables/llx_user_param.sql index d1019930332..fc4547f598c 100644 --- a/pgsql/tables/llx_user_param.sql +++ b/pgsql/tables/llx_user_param.sql @@ -32,5 +32,7 @@ create table llx_user_param "page" varchar(255), "param" varchar(64), "value" varchar(255), - "UNIQUE" (fk_user,page,param) + UNIQUE(fk_user,page,param) ); + +CREATE INDEX idx_llx_user_param_fk_user_page_param ON llx_user_param (); diff --git a/pgsql/tables/llx_user_rights.sql b/pgsql/tables/llx_user_rights.sql index 883714ad29a..0ba39db4b8c 100644 --- a/pgsql/tables/llx_user_rights.sql +++ b/pgsql/tables/llx_user_rights.sql @@ -29,6 +29,7 @@ create table llx_user_rights ( rowid SERIAL PRIMARY KEY, "fk_user" integer NOT NULL, - "fk_id" integer NOT NULL + "fk_id" integer NOT NULL, + UNIQUE(fk_user,fk_id) ); diff --git a/pgsql/tables/llx_usergroup_rights.sql b/pgsql/tables/llx_usergroup_rights.sql index 5c47b3cdb97..10214e4d2bd 100644 --- a/pgsql/tables/llx_usergroup_rights.sql +++ b/pgsql/tables/llx_usergroup_rights.sql @@ -30,6 +30,8 @@ create table llx_usergroup_rights rowid SERIAL PRIMARY KEY, "fk_usergroup" integer NOT NULL, "fk_id" integer NOT NULL, - "UNIQUE"(fk_usergroup,fk_id) + UNIQUE(fk_usergroup,fk_id) ); +CREATE INDEX idx_llx_usergroup_rights_fk_usergroup_fk_id ON llx_usergroup_rights (); + diff --git a/pgsql/tables/llx_usergroup_user.sql b/pgsql/tables/llx_usergroup_user.sql index c3775fe87a3..721b32baa94 100644 --- a/pgsql/tables/llx_usergroup_user.sql +++ b/pgsql/tables/llx_usergroup_user.sql @@ -30,5 +30,7 @@ create table llx_usergroup_user rowid SERIAL PRIMARY KEY, "fk_user" integer NOT NULL, "fk_usergroup" integer NOT NULL, - "UNIQUE"(fk_user,fk_usergroup) + UNIQUE(fk_user,fk_usergroup) ); + +CREATE INDEX idx_llx_usergroup_user_fk_user_fk_usergroup ON llx_usergroup_user ();