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.19.2 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.19.1 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.19.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.18.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.17.2 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.17.1 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.17.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.16.3 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.16.2 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.16.1 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.7 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.16.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.6 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.5 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.4 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.3 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.2 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.1 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.15.0 db/migrate/20140221201915_create_user_roles.rb
think_feel_do_engine-3.14.9 db/migrate/20140221201915_create_user_roles.rb