Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Last active August 16, 2023 15:38
Show Gist options
  • Save dillonhafer/7f07e8571ce998bfe79fed9392fd5e38 to your computer and use it in GitHub Desktop.
Save dillonhafer/7f07e8571ce998bfe79fed9392fd5e38 to your computer and use it in GitHub Desktop.
Tern diff
function terndiff() {
temp_db_name="tern_dev_$(date +%s)"
dropdb $temp_db_name 2>/dev/null
createdb $temp_db_name
PGDATABASE=$temp_db_name tern migrate >/dev/null
expected_structure=$(PGDATABASE=$temp_db_name pg_dump -s)
dropdb $temp_db_name
current_structure=$(pg_dump -s)
delta <(printf '%s\n' "$current_structure") <(printf '%s\n' "$expected_structure")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment