rake db:schema:load vs. migrations

前端 未结 7 1142
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 09:39

Very simple question here - if migrations can get slow and cumbersome as an app gets more complex and if we have the much cleaner rake db:schema:load to call in

7条回答
  •  生来不讨喜
    2020-11-27 10:05

    I have already posted as a comment, but feels it is better to put the comments of the db/schema.rb file here:

    # Note that this schema.rb definition is the authoritative source for your
    # database schema. If you need to create the application database on another
    # system, you should be using db:schema:load, not running all the migrations
    # from scratch. The latter is a flawed and unsustainable approach (the more migrations
    # you'll amass, the slower it'll run and the greater likelihood for issues).
    #
    # It's strongly recommended that you check this file into your version control system.
    

    Actually, my experience is that it is better to put the migration files in git and not the schema.rb file...

提交回复
热议问题