hensei-api/db/migrate/20251204063628_create_crews.rb
Justin Edmund 9b01aa0ff3 add crew and crew_membership models with migrations
- crews table with name, gamertag, granblue_crew_id, description
- crew_memberships with role enum (member/vice_captain/captain)
- partial unique index ensures one active crew per user
- updated User model with crew associations and helper methods
2025-12-03 22:41:19 -08:00

15 lines
382 B
Ruby

class CreateCrews < ActiveRecord::Migration[8.0]
def change
create_table :crews, id: :uuid do |t|
t.string :name, null: false
t.string :gamertag
t.string :granblue_crew_id
t.text :description
t.timestamps
end
add_index :crews, :name
add_index :crews, :granblue_crew_id, unique: true, where: "granblue_crew_id IS NOT NULL"
end
end