Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/faction.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# TODO(plural): add a side code to faction.
class Faction < ApplicationRecord
belongs_to :side
has_many :cards
end
1 change: 1 addition & 0 deletions app/models/side.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

class Side < ApplicationRecord
has_many :cards
has_many :factions
end
2 changes: 2 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
create_table "factions", id: :string, force: :cascade do |t|
t.boolean "is_mini", null: false
t.text "name", null: false
t.text "side_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
Expand Down Expand Up @@ -118,6 +119,7 @@
add_foreign_key "cards", "card_types", column: "card_type_id", primary_key: "id"
add_foreign_key "cards", "factions", column: "faction_id", primary_key: "id"
add_foreign_key "cards", "sides", column: "side_id", primary_key: "id"
add_foreign_key "factions", "sides", column: "side_id", primary_key: "id"
add_foreign_key "printings", "cards", column: "card_id", primary_key: "id"
add_foreign_key "printings", "card_sets", column: "card_set_id", primary_key: "id"
end
1 change: 1 addition & 0 deletions lib/tasks/cards.rake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace :cards do
factions.map! do |f|
{
id: f['code'],
side_id: f['side_code'],
name: f['name'],
is_mini: f['is_mini']
}
Expand Down