rails icon indicating copy to clipboard operation
rails copied to clipboard

Optimize add_timestamps to use a single SQL statement when supported

Open ilianah opened this issue 1 year ago • 0 comments

Summary

Both MySQL and PostgreSQL support dropping multiple columns in a single SQL statement.

SQLite3 does not support this feature so its adapter overrides the add_timestamps method to workaround SQLite3's ALTER TABLE limitations.

The add_timestamps_for_alter method creates the ALTER TABLE SQL fragments to execute.

Same approach as https://github.com/rails/rails/pull/42075

ilianah avatar Aug 01 '22 17:08 ilianah