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:
parent
40ac2aa528
commit
6ebb21b660
3 changed files with 12 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue