add everything to manage reputations

This commit is contained in:
2021-05-01 00:22:15 +02:00
parent ca80fd55fa
commit d227cdc87c
30 changed files with 366 additions and 43 deletions

View File

@@ -0,0 +1,12 @@
class CreateWowReputationTiers < ActiveRecord::Migration[6.1]
def change
create_table :wow_reputation_tiers do |t|
t.string :href
t.integer :reputation_tier_id, null: false
t.timestamps
end
add_index :wow_reputation_tiers, :reputation_tier_id, unique: true
end
end

View File

@@ -0,0 +1,13 @@
class CreateWowReputationTierLevels < ActiveRecord::Migration[6.1]
def change
create_table :wow_reputation_tier_levels do |t|
t.jsonb :name
t.integer :min_value
t.integer :max_value
t.integer :order
t.belongs_to :wow_reputation_tier
t.timestamps
end
end
end

View File

@@ -0,0 +1,17 @@
class CreateWowReputations < ActiveRecord::Migration[6.1]
def change
create_table :wow_reputations do |t|
t.jsonb :name
t.string :href
t.string :faction
t.jsonb :translated_faction
t.jsonb :description
t.integer :reputation_id, null: false
t.belongs_to :wow_reputation_tier
t.timestamps
end
add_index :wow_reputations, :reputation_id, unique: true
end
end

View File

@@ -0,0 +1,15 @@
class CreateWowStandings < ActiveRecord::Migration[6.1]
def change
create_table :wow_standings do |t|
t.belongs_to :wow_character
t.belongs_to :wow_reputation
t.integer :raw
t.integer :value
t.integer :max
t.integer :tier
t.jsonb :name
t.timestamps
end
end
end

View File

@@ -0,0 +1,5 @@
class AddIndexToWowReputationTierOrder < ActiveRecord::Migration[6.1]
def change
add_index :wow_reputation_tier_levels, :order
end
end

View File

@@ -0,0 +1,5 @@
class AddWowReputationSelfJoin < ActiveRecord::Migration[6.1]
def change
add_reference :wow_reputations, :meta_wow_reputation, foreign_key: { to_table: :wow_reputations }
end
end

53
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_04_29_161239) do
ActiveRecord::Schema.define(version: 2021_04_30_213202) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -263,6 +263,57 @@ ActiveRecord::Schema.define(version: 2021_04_29_161239) do
t.index ["realm_id"], name: "index_wow_realms_on_realm_id", unique: true
end
create_table "wow_reputation_tier_levels", force: :cascade do |t|
t.jsonb "name"
t.integer "min_value"
t.integer "max_value"
t.integer "order"
t.bigint "wow_reputation_tier_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["order"], name: "index_wow_reputation_tier_levels_on_order"
t.index ["wow_reputation_tier_id"], name: "index_wow_reputation_tier_levels_on_wow_reputation_tier_id"
end
create_table "wow_reputation_tiers", force: :cascade do |t|
t.string "href"
t.integer "reputation_tier_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["reputation_tier_id"], name: "index_wow_reputation_tiers_on_reputation_tier_id", unique: true
end
create_table "wow_reputations", force: :cascade do |t|
t.jsonb "name"
t.string "href"
t.string "faction"
t.jsonb "translated_faction"
t.jsonb "description"
t.integer "reputation_id", null: false
t.bigint "wow_reputation_tier_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.bigint "meta_wow_reputation_id"
t.index ["meta_wow_reputation_id"], name: "index_wow_reputations_on_meta_wow_reputation_id"
t.index ["reputation_id"], name: "index_wow_reputations_on_reputation_id", unique: true
t.index ["wow_reputation_tier_id"], name: "index_wow_reputations_on_wow_reputation_tier_id"
end
create_table "wow_standings", force: :cascade do |t|
t.bigint "wow_character_id"
t.bigint "wow_reputation_id"
t.integer "raw"
t.integer "value"
t.integer "max"
t.integer "tier"
t.jsonb "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["wow_character_id"], name: "index_wow_standings_on_wow_character_id"
t.index ["wow_reputation_id"], name: "index_wow_standings_on_wow_reputation_id"
end
add_foreign_key "wow_characters", "wow_geo_positions", column: "bind_position_id"
add_foreign_key "wow_characters", "wow_geo_positions", column: "last_position_id"
add_foreign_key "wow_reputations", "wow_reputations", column: "meta_wow_reputation_id"
end