Avoid using live models in old migrations

Instead, we define models in the migrations themselves. This ensures that
column names etc match the state of the database during the migration,
not the current live version of the model.
This commit is contained in:
Andy Allan 2019-07-17 11:52:02 +02:00
parent 40ac2aa528
commit 6ebb21b660
3 changed files with 12 additions and 0 deletions

View file

@ -1,4 +1,7 @@
class TileUsers < ActiveRecord::Migration[5.1]
class User < ActiveRecord::Base
end
def up
add_column :users, :home_tile, :bigint
add_index :users, [:home_tile], :name => "users_home_idx"