Skip to content

Conversation

@ceritium
Copy link
Contributor

@ceritium ceritium commented Sep 4, 2021

Summary

Closes #42582

Almost every model gets new columns after creation, leaving the timestamps at
an awkward position between the initial columns and everything else.

For the command bin/rails g model Book title it will generate:

class CreateBooks < ActiveRecord::Migration[7.0]
  def change
    create_table :books do |t|
      t.timestamps

      t.string :title
    end
  end
end

@ceritium ceritium force-pushed the migration-timestamps-top branch from b434d06 to df0e81c Compare September 5, 2021 08:15
Closes rails#42582

Almost every model gets new columns after creation, leaving the timestamps at
an awkward position between the initial columns and everything else.

For the command `bin/rails g model Book title` it will generate:

```ruby
class CreateBooks < ActiveRecord::Migration[7.0]
  def change
    create_table :books do |t|
      t.timestamps

      t.string :title
    end
  end
end
```
@ceritium ceritium force-pushed the migration-timestamps-top branch from df0e81c to e785244 Compare September 5, 2021 16:42
@ceritium ceritium marked this pull request as ready for review September 5, 2021 17:19
@rafaelfranca
Copy link
Member

Thank you for the pull request but I don't think we have enough reason to change this. Like you said, it is just a cosmetic change that doesn't increase usability of the framework neither make anything easier to perform with it, so I prefer to not accept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Define timestamps as two first columns in migrations by default

2 participants