Skip to content

Commit

Permalink
Fixes for dump all db and restore all db
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Nardecchia authored and Alessandro Nardecchia committed May 7, 2024
1 parent a9b4cf2 commit 929d121
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions imageroot/actions/configure-module/80start_services
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ sleep 2
systemctl --user enable postgres.service
systemctl --user restart postgres.service

# if first execution wait some time for postgres to load default DB
sleep 10
sleep 5

# Enable and restart the odoo-app service
systemctl --user enable odoo-app.service
Expand Down
3 changes: 2 additions & 1 deletion imageroot/actions/create-module/20postgres
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ sleep 2
systemctl --user enable postgres.service
systemctl --user restart postgres.service

sleep 5
# first execution wait some time for postgres to load default DB
sleep 10
8 changes: 7 additions & 1 deletion imageroot/actions/restore-module/40restore-postgres
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ exec 1>&2 # Redirect any output to the journal (stderr)

# restore odoo db
echo "Restoring odoo postgres database"
podman exec -i postgres psql -U odoo -d odoo < odoo.pg_dump


# remove all tables from default odoo db.
podman exec -i postgres psql -U odoo -d odoo -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO odoo; GRANT ALL ON SCHEMA public TO public;"

# restore all dbs
podman exec -i postgres psql -U odoo < odoo.pg_dump

2 changes: 1 addition & 1 deletion imageroot/bin/module-dump-state
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
set -e

echo "Dumping odoo postgres databases"
podman exec postgres pg_dumpall -U odoo -w > odoo.pg_dump
podman exec postgres pg_dumpall --clean -U odoo -w > odoo.pg_dump

0 comments on commit 929d121

Please sign in to comment.