Sha256: e7d1fe3249aa217a8a06ae9eeaa058a07cc3075cbaf3cab4131002383e3a6b78

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

class MonarchyCreateMemberships < ActiveRecord::Migration
  def change
    create_table :monarchy_members do |t|
      t.belongs_to :user
      t.belongs_to :hierarchy
      t.timestamps null: false
    end

    create_table :monarchy_roles do |t|
      t.string :name, null: false
      t.integer :level, default: 0, null: false
      t.boolean :inherited, default: false, null: false
      t.timestamps null: false
    end

    add_index :monarchy_roles, :name, unique: true

    create_table :monarchy_members_roles do |t|
      t.belongs_to :role
      t.belongs_to :member
      t.timestamps null: false
    end

    add_index :monarchy_members_roles, [:role_id, :member_id], unique: true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monarchy-0.3.1 lib/generators/templates/migrations/membership.rb
monarchy-0.2.1 lib/generators/templates/migrations/membership.rb