From 9fca00232c26ecf512985f9477e7bdbbb8f68d82 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Dec 2010 15:23:17 +0100 Subject: [PATCH] =?utf8?q?Auth-DB-Schema-Normalisierung:=20Prim=C3=A4rschl?= =?utf8?q?=C3=BCssel=20f=C3=BCr=20Tabellen=20im=20auth-Schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../auth_schema_normalization_1.pl | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl 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; -- 2.20.1