feat(supabase): db:sandbox migrate, forward only on the running sandbox
This commit is contained in:
1 parent
f3712b2baa
commit
21c9a81e0c
2 files changed
+14
No files matched your search
@@ -265,6 +265,18 @@ cmd_up() {
|
||||
echo "== sandbox up ($mode): db 127.0.0.1:$PORT_DB, auth :$PORT_AUTH, rest :$PORT_REST, mail :$PORT_MAIL"
|
||||
}
|
||||
|
||||
# pnpm db:sandbox migrate: forward only, on the running sandbox; the branch's
|
||||
# pending migrations and nothing else (no reset, no seed, no container recreated).
|
||||
cmd_migrate() {
|
||||
[ $# -eq 0 ] || die "migrate takes no argument"
|
||||
docker ps --format '{{.Names}}' | grep -qx "$DB" || die "sandbox not up (pnpm db:sandbox up fresh)"
|
||||
load_secrets
|
||||
local last='select max(version) from supabase_migrations.schema_migrations'
|
||||
echo "== before: $(sb_psql -t -A -c "$last")"
|
||||
migrate_up .
|
||||
echo "== after: $(sb_psql -t -A -c "$last")"
|
||||
}
|
||||
|
||||
cmd_down() {
|
||||
docker rm -f "$AVATAR_WORKER" "$WORKER" "$TRIAL_GATEWAY" "$GATEWAY" "$REST" "$STORAGE" "$AUTH" "$MAIL" "$DB" >/dev/null 2>&1 || true
|
||||
docker network rm "$NET" >/dev/null 2>&1 || true
|
||||
@@ -521,6 +533,7 @@ case "${1:-}" in
|
||||
trial) cmd_trial ;;
|
||||
trial-account) shift; cmd_trial_account "$@" ;;
|
||||
trial-grant) shift; cmd_trial_grant "$@" ;;
|
||||
migrate) shift; cmd_migrate "$@" ;;
|
||||
sql) load_secrets; sb_psql ;;
|
||||
*) sed -n '2,36p' "$0"; exit 1 ;;
|
||||
esac
|
||||
Reference in new issue
Block a user