Sha256: 02b99c2861e01df5ce715ce51eae37f932b4429528fbbdea08577517b3385740

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

class CreateArpaTables < ActiveRecord::Migration
  def change

    create_table :repository_resources, :force => true do |t|
      t.string :name
      t.string :full_name
      t.timestamps null: false
    end

    create_table :repository_actions, :force => true do |t|
      t.string :name
      t.references :repository_resource, index: true
      t.timestamps null: false
    end

    add_foreign_key :repository_actions, :repository_resources

    create_table :repository_roles, :force => true do |t|
      t.string :name
      t.string :description
      t.boolean :removed, default: false
      t.timestamps null: false
    end

    create_join_table :repository_actions, :repository_roles, :force => true do |t|
      t.index :repository_action_id, name: 'action_role_id'
      t.index :repository_role_id, name: 'role_action_id'
    end

    create_table :repository_profiles, :force => true do |t|
      t.string :name
      t.string :description
      t.boolean :removed, default: false
      t.timestamps null: false
    end

    create_join_table :repository_roles, :repository_profiles, :force => true do |t|
      t.index :repository_role_id, name: 'role_profile_id'
      t.index :repository_profile_id, name: 'profile_role_ids'
    end

    create_join_table :repository_profiles, :users, :force => true do |t|
      t.index :repository_profile_id, name: 'profile_user_id'
      t.index :user_id, name: 'user_profile_id'
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arpa-0.0.6 lib/generators/arpa/templates/migration.rb
arpa-0.0.5 lib/generators/arpa/templates/migration.rb
arpa-0.0.4 lib/generators/arpa/templates/migration.rb
arpa-0.0.3 lib/generators/arpa/templates/migration.rb