add geo info and do refractor on workers

This commit is contained in:
2021-04-29 20:44:21 +02:00
parent f7799bb514
commit c5190b48f8
32 changed files with 241 additions and 205 deletions

View File

@@ -0,0 +1,12 @@
class CreateWowGeoZones < ActiveRecord::Migration[6.1]
def change
create_table :wow_geo_zones do |t|
t.integer :zone_id
t.jsonb :name
t.timestamps
end
add_index :wow_geo_zones, :zone_id, unique: true
end
end

View File

@@ -0,0 +1,12 @@
class CreateWowGeoMaps < ActiveRecord::Migration[6.1]
def change
create_table :wow_geo_maps do |t|
t.integer :map_id
t.jsonb :name
t.timestamps
end
add_index :wow_geo_maps, :map_id, unique: true
end
end

View File

@@ -0,0 +1,14 @@
class CreateWowGeoPositions < ActiveRecord::Migration[6.1]
def change
create_table :wow_geo_positions do |t|
t.float :x
t.float :y
t.float :z
t.float :facing
t.belongs_to :wow_geo_zone
t.belongs_to :wow_geo_map
t.timestamps
end
end
end

View File

@@ -0,0 +1,9 @@
class AddWowGeoPositionToWowCharacter < ActiveRecord::Migration[6.1]
def change
add_column :wow_characters, :last_position_id, :bigint
add_column :wow_characters, :bind_position_id, :bigint
add_foreign_key :wow_characters, :wow_geo_positions, column: :last_position_id, primary_key: :id
add_foreign_key :wow_characters, :wow_geo_positions, column: :bind_position_id, primary_key: :id
end
end

35
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_132126) do
ActiveRecord::Schema.define(version: 2021_04_29_161239) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -127,6 +127,8 @@ ActiveRecord::Schema.define(version: 2021_04_29_132126) do
t.string "href"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.bigint "last_position_id"
t.bigint "bind_position_id"
t.index ["character_id"], name: "index_wow_characters_on_character_id", unique: true
t.index ["user_id"], name: "index_wow_characters_on_user_id"
t.index ["wow_character_title_id"], name: "index_wow_characters_on_wow_character_title_id"
@@ -147,6 +149,35 @@ ActiveRecord::Schema.define(version: 2021_04_29_132126) do
t.index ["class_id"], name: "index_wow_classes_on_class_id", unique: true
end
create_table "wow_geo_maps", force: :cascade do |t|
t.integer "map_id"
t.jsonb "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["map_id"], name: "index_wow_geo_maps_on_map_id", unique: true
end
create_table "wow_geo_positions", force: :cascade do |t|
t.float "x"
t.float "y"
t.float "z"
t.float "facing"
t.bigint "wow_geo_zone_id"
t.bigint "wow_geo_map_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["wow_geo_map_id"], name: "index_wow_geo_positions_on_wow_geo_map_id"
t.index ["wow_geo_zone_id"], name: "index_wow_geo_positions_on_wow_geo_zone_id"
end
create_table "wow_geo_zones", force: :cascade do |t|
t.integer "zone_id"
t.jsonb "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["zone_id"], name: "index_wow_geo_zones_on_zone_id", unique: true
end
create_table "wow_mounts", force: :cascade do |t|
t.jsonb "name"
t.string "source_type"
@@ -232,4 +263,6 @@ ActiveRecord::Schema.define(version: 2021_04_29_132126) do
t.index ["realm_id"], name: "index_wow_realms_on_realm_id", unique: true
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"
end