Why is schema.rb not formatted correctly in rails 5.1.0?

Schema.rb used to be a good place to quickly see what the default values ​​for the columns were and whether they could be nullable, but now it's messy. For example, here is a user table:

create_table "users", force: :cascade do |t|
  t.string   "name",                              null: false
  t.string   "email",                             null: false
  t.string   "locale",          default: "en-ca", null: false
  t.string   "password_digest",                   null: false
  t.datetime "created_at",                        null: false
  t.datetime "updated_at",                        null: false
  t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
end

And now it looks awful:

create_table "users", id: :serial, force: :cascade do |t|
  t.string "name", null: false
  t.string "email", null: false
  t.string "locale", default: "en-ca", null: false
  t.string "password_digest", null: false
  t.datetime "created_at", null: false
  t.datetime "updated_at", null: false
  t.index ["email"], name: "index_users_on_email", unique: true
end

Why did this happen and how can I fix it while maintaining good changes, such id: :serialas implicit ones btree?

+4
source share
1 answer

This has been specifically modified in this commit.

schema.rb 50 , , , , .

, . , .

Edit:

script, . , , edgecases. , , , .

Edit2:

hacky script . , .

+7

Source: https://habr.com/ru/post/1676389/


All Articles