BUCKYVERSE

Legacy Wiki.js push to new DB and instant rollback

When you push database changes to production with push-to-prod.sh, the script no longer overwrites the live production database. Instead it:

  1. Creates a new database on the prod Postgres instance (e.g. wiki_20260217_143022).
  2. Restores your local dump into that new database. The current prod database (e.g. wiki) is left unchanged.
  3. Switch (optional): You then point the old Wiki.js app at the new database. If something goes wrong, rollback is instant by pointing back at the previous database.

Push flow

From dev/wikijs:

./scripts/push-to-prod.sh          # DB only: creates new DB, restores; prints how to switch
./scripts/push-to-prod.sh --data   # Same + sync wiki data volume (if PROD_WIKI_VOLUME set)
./scripts/push-to-prod.sh --switch # Same + auto-switch Wiki.js to new DB (requires PROD_COMPOSE_DIR)

Rollback

If the new database causes issues:

  1. On the server, set DB_NAME back to the previous database (e.g. wiki or the last known-good name like wiki_20260214_120000).
  2. Recreate the wiki container so it uses the updated env, e.g.:
    cd $COMPOSE_DIR && docker-compose up -d wiki --force-recreate
    
    Wiki.js will connect to the old database again; no data restore needed.

Cleanup (optional)

Old databases remain on the prod Postgres instance until you drop them. To free space after you are satisfied with a push:

# On the server, connect to Postgres and list databases
docker exec -it db psql -U postgres -c '\l'

# Drop an old database (only when you no longer need it for rollback)
docker exec db psql -U postgres -c 'DROP DATABASE wiki_20260201_100000;'

Requirements