Sha256: 577f9fc266e35a080ccde0fb463dcf963218171bc6a23d19e1540bbf53ae55de

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 Bytes

Contents

class CreatePermisiTables < ActiveRecord::Migration<%= migration_version %>
  def up
    create_table :permisi_actors do |t|
      t.references :aka, polymorphic: true
      t.timestamps
    end

    add_index :permisi_actors, [:aka_type, :aka_id]

    create_table :permisi_roles do |t|
      t.string :slug, null: false, unique: true
      t.string :name, null: false, unique: true
      t.json :permissions
      t.timestamps
    end

    create_table :permisi_actor_roles do |t|
      t.belongs_to :actor
      t.belongs_to :role
    end

    add_index :permisi_actor_roles, [:actor_id, :role_id], unique: true
  end

  def down
    drop_table :permisi_actor_roles
    drop_table :permisi_roles
    drop_table :permisi_actors
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
permisi-0.1.5 lib/generators/permisi/templates/migration.rb
permisi-0.1.4 lib/generators/permisi/templates/migration.rb