docbrown/db/migrate/20190415194929_create_organization_memberships.rb
Andy Zhao 182a787ac4 Add OrganizationMembership model (#2471)
* Remove deprecated analytics role

* Make anchor tag a bit more readable

* Add OrganizationMembership table and model

* Add organization_membership associations

* Add unique indices for user_id and org_id

* Wrap update and create calls in transactions

* Remove specs of deprecated analytics_beta_tester
2019-04-22 14:08:02 -04:00

13 lines
414 B
Ruby

class CreateOrganizationMemberships < ActiveRecord::Migration[5.2]
def change
create_table :organization_memberships do |t|
t.bigint :user_id, null: false
t.bigint :organization_id, null: false
t.string :user_title
t.string :type_of_user, null: false
t.timestamps null: false
end
add_index :organization_memberships, %i[user_id organization_id], unique: true
end
end