]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Use transation to create PostgreSQL schema
authorEric Bollengier <eric@baculasystems.com>
Mon, 18 Oct 2021 18:53:33 +0000 (20:53 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:56 +0000 (13:56 +0200)
bacula/src/cats/grant_postgresql_privileges.in
bacula/src/cats/make_postgresql_tables.in

index 4d6187fcd320ab62b6e44347ee5b825a8568792b..b8c7fbd0c47dfc538ff2b730f314477fe624878e 100644 (file)
@@ -21,6 +21,7 @@ create user ${db_user} ${pass};
 
 -- for the database
 alter database ${db_name} owner to ${db_user} ;
+grant CREATE on DATABASE ${db_name} to ${db_user};
 
 -- for tables
 grant all on MetaEmail    to ${db_user};
index 4481a53432a3fc20b8f4a62d8aeeedfc74549366..5be98e80ea1f739a26ed5c8e5f03654ea00ed52b 100644 (file)
@@ -15,6 +15,7 @@ db_name=${db_name:-@db_name@}
 
 psql -f - -d ${db_name} $* <<END-OF-DATA
 
+BEGIN;
 -- --------------------------------------------------------------
 -- MetaData Index
 
@@ -630,8 +631,9 @@ CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device text_pattern_ops,
 
 INSERT INTO Version (VersionId) VALUES (1025);
 
--- Make sure we have appropriate permissions
 
+COMMIT;
+-- Make sure we have appropriate permissions
 
 END-OF-DATA
 pstat=$?