Sha256: 5c254f087f9575e632ba4c041d692aa1f13718927c13565c42ab44003d1086d7

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

class BobbyCreateTables < ActiveRecord::Migration
   def self.up
     create_table :permissions do |t|
       t.string :name
       t.string :actions_allowed
       t.text   :on_tables

       t.timestamps
     end
     create_table :roles do |t|
       t.string :name

       t.timestamps
     end
     create_table :authorisations do |t|
       t.references :authorisable, :polymorphic => true 
       t.integer :role_id

       t.timestamps
     end
     create_table :permissions_roles, :id => false do |t| 
       t.integer :permission_id
       t.integer :role_id

       t.timestamps
     end
     create_table :group_users do |t|
       t.string :name

       t.timestamps
     end
     create_table :group_users_users, :id => false do |t| 
       t.integer :group_user_id
       t.integer :user_id

       t.timestamps
     end

   end

   def self.down
     drop_table :group_users_users
     drop_table :group_users
     drop_table :permissions_roles
     drop_table :authorisations
     drop_table :roles
     drop_table :permissions
   end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bobby-0.0.4 lib/generators/bobby/install/templates/migration.rb