Sha256: 3d0c76d571e43ad0ddd00edc0d75ef5a96b804b58f4b1d7e2a53fa82da77819e

Contents?: true

Size: 538 Bytes

Versions: 68

Compression:

Stored size: 538 Bytes

Contents

class CreateUserRoles < ActiveRecord::Migration
  def change
    create_table :user_roles do |t|
      t.references :user, index: true, null: false
      t.string :role_class_name, null: false

      t.timestamps
    end

    add_index :user_roles, [:role_class_name, :user_id], unique: true

    reversible do |dir|
      dir.up do
        execute <<-SQL
          ALTER TABLE user_roles
            ADD CONSTRAINT fk_roles_users
            FOREIGN KEY (user_id)
            REFERENCES users(id)
        SQL
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.12.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.11.3 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.11.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.10.10 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.10.9 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.10.8 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.10.7 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.10.6 db/migrate/20140221201915_create_user_roles.rb