4 ms·
Ask HN: How do you version control your database schema changes?
- hardwaresofton 4y agoAs part of code that runs when the application runs. Always write migrations that can be adopted gradually, and always use transactions where possible. RIP to those not using Postgres who can’t use DDL in transactions.
- johng 4y agoMysqldump and rdiff-backup
- amalgamated_inc 4y agoCheck in the migrations
- sargstuff 4y agocommand line script method: 1) Get/select the structre/definition for table(s) in given schema/database via comand line script. Exact way to do this varies by database (mysql, pgsql, informix, oracle, etc) 2) upload/check in info from #1 to version control system. edit per hardwaresofton note about DDL in transactions (way noted below is still a RIP, just less so than 'manual' DDL extraction): Always old school script(s) to extract/display relevant schema/database DDL changes from transactional log in source control format. This does assume that full/complete transaction log is available to parse.
- Minor49er 4y agoMigrations, typically via Phinx for PHP