If you are running maas-test-db
for your development environment and want to persist your data between upgrades to a newer version, you can use db-dump
script.
- Backup your existing data
sudo snap run --shell maas-test-db.psql -c 'db-dump dump $SNAP_COMMON/maasdb.dump maasdb'
- Copy your backup out of snap common
cp /var/snap/maas-test-db/common/maasdb.dump /some/where/maasdb.dump
- Make a clean snap install of
maas-test-db
sudo snap remove maas-test-db
sudo snap install --channel=latest/edge
- Drop default database maasdb (optional)
snap run --shell maas-test-db.psql -c 'psql.wrapper -d postgres -c "drop database maasdb;"'
- Restore your data
cp /some/where/maasdb.dump /var/snap/maas-test-db/common/maasdb.dump
sudo snap run --shell maas-test-db.psql -c 'db-dump restore $SNAP_COMMON/maasdb.dump maasdb maas'