lib/generators/templates/migrations/membership.rb in monarchy-0.3.1 vs lib/generators/templates/migrations/membership.rb in monarchy-1.0.0

- old
+ new

@@ -7,20 +7,32 @@ end create_table :monarchy_roles do |t| t.string :name, null: false t.integer :level, default: 0, null: false + t.integer :inherited_role_id 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_hierarchies, :parent_id + add_index :monarchy_hierarchies, :resource_id + + add_index :monarchy_members, :hierarchy_id + add_index :monarchy_members, :user_id + + add_index :monarchy_roles, :level + add_index :monarchy_roles, :inherited + add_index :monarchy_roles, :inherited_role_id + add_index :monarchy_roles, :name, unique: true + add_index :monarchy_members_roles, [:role_id, :member_id], unique: true + add_index :monarchy_members_roles, :member_id + add_index :monarchy_members_roles, :role_id end end