Is it possible to output the SQL change scripts that 'rake db:migrate' produces?

后端 未结 5 1286
失恋的感觉
失恋的感觉 2020-12-04 19:00

Is it possible to output the SQL change scripts that \'rake db:migrate\' produces?

5条回答
  •  醉话见心
    2020-12-04 19:47

    I put together the capture_migration_sql gem for this purpose. It will dump your migration SQL to files in db/migration_sql.

    It's overkill if you just need to find a single SQL statement, but is great to have if your production process requires the raw SQL statements. It can also make reviewing complex database changes in code reviews a bit easier since there's no ruby -> SQL mental math required.

提交回复
热议问题