Sha256: 679fb106fb6723e81eb01aa437b02bce5ffdfd6f17a86e9a1cddd89ed0f6ad27

Contents?: true

Size: 667 Bytes

Versions: 4

Compression:

Stored size: 667 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
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
permisi-0.1.3 lib/generators/permisi/templates/migration.rb
permisi-0.1.2 lib/generators/permisi/templates/migration.rb
permisi-0.1.1 lib/generators/permisi/templates/migration.rb
permisi-0.1.0 lib/generators/permisi/templates/migration.rb