TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do you version control your database schema changes?

1 pointsby iio7over 2 years ago

5 comments

hardwaresoftonover 2 years ago
As part of code that runs when the application runs.<p>Always write migrations that can be adopted gradually, and always use transactions where possible.<p>RIP to those not using Postgres who can’t use DDL in transactions.
sargstuffover 2 years ago
command line script method:<p>1) Get&#x2F;select the structre&#x2F;definition for table(s) in given schema&#x2F;database via comand line script. Exact way to do this varies by database (mysql, pgsql, informix, oracle, etc)<p>2) upload&#x2F;check in info from #1 to version control system.<p>edit per hardwaresofton note about DDL in transactions (way noted below is still a RIP, just less so than &#x27;manual&#x27; DDL extraction):<p>Always old school script(s) to extract&#x2F;display relevant schema&#x2F;database DDL changes from transactional log in source control format.<p>This does assume that full&#x2F;complete transaction log is available to parse.
amalgamated_incover 2 years ago
Check in the migrations
Minor49erover 2 years ago
Migrations, typically via Phinx for PHP
johngover 2 years ago
Mysqldump and rdiff-backup