Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debian: changed postgresql database owner
Allows dbconfig-common database updates to Bareos DB version 2170. PostgreSQL needs special handling.
- Loading branch information
1 parent
8c25b7e
commit 6f27e7d
Showing
9 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@working_dir@/dbconfig-common/upgrade-dbadmin/pgsql/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
platforms/debian/dbconfig-common/scripts/bareos-database-common/upgrade/pgsql/2170
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
# parameter: | ||
# 1: dbc_package | ||
# 2: action | ||
# 3: if action = configure: most-recently-configured-version | ||
|
||
dbc_confdir="/etc/dbconfig-common" | ||
dbc_share="/usr/share/dbconfig-common" | ||
dbc_package="bareos-database-common" | ||
|
||
dbc_packageconfig="$dbc_confdir/$dbc_package.conf" | ||
|
||
dbversion=`basename $0` | ||
|
||
template="/usr/lib/bareos/scripts/ddl/grants/postgresql-change_owner.dbconfig-template.sql" | ||
target="/var/lib/bareos/dbconfig-common/upgrade-dbadmin/pgsql/$dbversion" | ||
|
||
/usr/sbin/dbconfig-generate-include -f template -o template_infile=$template $dbc_packageconfig > $target | ||
|
12 changes: 12 additions & 0 deletions
12
src/cats/ddl/grants/postgresql-change_owner.dbconfig-template.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- | ||
-- change table owner | ||
-- | ||
|
||
CREATE OR REPLACE FUNCTION execute(text) | ||
returns void as $BODY$BEGIN raise notice 'exec: %',$1; execute $1; END;$BODY$ language plpgsql; | ||
|
||
SELECT execute('ALTER TABLE '|| tablename ||' OWNER TO _DBC_DBUSER_;') | ||
FROM pg_tables WHERE schemaname='public' AND tableowner!='_DBC_DBUSER_'; | ||
|
||
DROP FUNCTION execute(text); | ||
|