X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fpg-readonly;h=b5cde4d6ecf66f1fafbad82450845bbe13b48e09;hp=4f6d7c380c1978a28ce80662fdb29ccb299cb2bc;hb=a36e0f8a0f69349dafaa16d1d2d57dfb6e5dbc85;hpb=5021bac8641bc1eac15372d455a256123f98ae67 diff --git a/bin/pg-readonly b/bin/pg-readonly index 4f6d7c380..b5cde4d6e 100644 --- a/bin/pg-readonly +++ b/bin/pg-readonly @@ -17,6 +17,39 @@ my $dbh = adminsuidsetup $user; foreach my $table ( dbdef->tables ) { $dbh->do("GRANT SELECT ON $table TO $rouser"); $dbh->commit(); - $dbh->do("GRANT SELECT ON ${table}_seq TO $rouser"); + if ( my $pkey = dbdef->table($table)->primary_key ) { + $dbh->do("GRANT SELECT ON ${table}_${pkey}_seq TO $rouser"); + $dbh->commit(); + } +} + +my @rt_tables = qw( +Attachments +Queues +Links +Principals +Groups +ScripConditions +Transactions +Scrips +ACL +GroupMembers +CachedGroupMembers +Users +Tickets +ScripActions +Templates +ObjectCustomFieldValues +CustomFields +ObjectCustomFields +CustomFieldValues +Attributes +sessions +); + +foreach my $table ( @rt_tables ) { + $dbh->do("GRANT SELECT ON $table TO $rouser"); + $dbh->commit(); + $dbh->do("GRANT SELECT ON ${table}_id_seq TO $rouser"); $dbh->commit(); }