From: Moritz Bunkus Date: Thu, 30 Dec 2010 14:23:17 +0000 (+0100) Subject: Auth-DB-Schema-Normalisierung: Primärschlüssel für Tabellen im auth-Schema X-Git-Tag: release-2.6.2beta1~17^2~10 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9fca00232c26ecf512985f9477e7bdbbb8f68d82;p=kivitendo-erp.git Auth-DB-Schema-Normalisierung: Primärschlüssel für Tabellen im auth-Schema --- diff --git a/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl new file mode 100644 index 000000000..78726cc67 --- /dev/null +++ b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# @tag: auth_schema_normalization_1 +# @description: Auth-Datenbankschema Normalisierungen Teil 1 +# @depends: + +use strict; + +sub do_one { + my ($dbh, $query) = @_; + + if ($dbh->do($query)) { + $dbh->commit(); + } else { + $dbh->rollback(); + } +} + +sub do_all { + my $dbh = $::auth->dbconnect(); + + my @queries = ( qq|ALTER TABLE auth.group_rights ADD PRIMARY KEY (group_id, "right");|, + qq|ALTER TABLE auth.user_config ADD PRIMARY KEY (user_id, cfg_key);|, + qq|ALTER TABLE auth.user_group ADD PRIMARY KEY (user_id, group_id);|); + + do_one($dbh, $_) for @queries; +} + +do_all(); + +1;