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.
require "migrate"
class CreateUserRoles < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
+ class UserRole < ActiveRecord::Base
+ end
+
def self.up
create_enumeration :user_role_enum, %w[administrator moderator]
class AddUserImageFingerprint < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def up
add_column :users, :image_fingerprint, :string, :null => true
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"