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.
command line script method:<p>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)<p>2) upload/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 'manual' DDL extraction):<p>Always old school script(s) to extract/display relevant schema/database DDL changes from transactional log in source control format.<p>This does assume that full/complete transaction log is available to parse.