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