I'm working with an existing rails app, using postgresql. Its schema.rb file has id: :serial
for many, but not all, tables:
create_table "foos", id: :serial, force: :cascade do |t|
When I run rails db:migrate:reset
, id: :serial
is removed. We are all on the same version of postgres, but different OSes. I haven't exhaustively tested the behavior between machines, but I think there is a difference between machines.
The rails version is the same as it was when the project started.
The project did start with sqlite3. When I switch to that and regenerate the file, same behavior.
What could cause this option to be removed in my environment?
here's some code that is probably relevant:
- https://github.com/rails/rails/blob/b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c/activerecord/lib/active_record/connection_adapters/postgresql/column.rb#L15-L21
- https://github.com/rails/rails/blob/b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb#L26-L42
update
- I just tried
rails db:migrate:reset
on colleague's machines, and I was wrong! their environments also removeid: :serial
. - I looked closer at recent migrations from a colleague, and the most recent one did not create
id: :serial
in schema.rb either.