initial rebuild from v1
This commit is contained in:
26
db/migrate/20210422154238_devise_create_users.rb
Normal file
26
db/migrate/20210422154238_devise_create_users.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DeviseCreateUsers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :users do |t|
|
||||
## Database authenticatable
|
||||
t.string :email
|
||||
t.string :encrypted_password
|
||||
|
||||
## Rememberable
|
||||
t.datetime :remember_created_at
|
||||
|
||||
# Bnet fields
|
||||
t.string :battletag, null: false
|
||||
t.string :provider
|
||||
t.string :uid
|
||||
t.boolean :token_expires
|
||||
t.timestamp :token_expire_at
|
||||
t.string :token
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :users, :battletag, unique: true
|
||||
end
|
||||
end
|
||||
13
db/migrate/20210422160150_create_text_translations.rb
Normal file
13
db/migrate/20210422160150_create_text_translations.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateTextTranslations < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :mobility_text_translations do |t|
|
||||
t.string :locale, null: false
|
||||
t.string :key, null: false
|
||||
t.text :value
|
||||
t.references :translatable, polymorphic: true, index: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_text_translations_on_keys
|
||||
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_text_translations_on_translatable_attribute
|
||||
end
|
||||
end
|
||||
14
db/migrate/20210422160151_create_string_translations.rb
Normal file
14
db/migrate/20210422160151_create_string_translations.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateStringTranslations < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :mobility_string_translations do |t|
|
||||
t.string :locale, null: false
|
||||
t.string :key, null: false
|
||||
t.string :value
|
||||
t.references :translatable, polymorphic: true, index: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
add_index :mobility_string_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_string_translations_on_keys
|
||||
add_index :mobility_string_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_string_translations_on_translatable_attribute
|
||||
add_index :mobility_string_translations, [:translatable_type, :key, :value, :locale], name: :index_mobility_string_translations_on_query_keys
|
||||
end
|
||||
end
|
||||
19
db/migrate/20210422191934_create_wow_realms.rb
Normal file
19
db/migrate/20210422191934_create_wow_realms.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateWowRealms < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_realms do |t|
|
||||
t.jsonb :name
|
||||
t.string :href
|
||||
t.string :slug
|
||||
t.jsonb :category
|
||||
t.string :locale
|
||||
t.string :timezone
|
||||
t.jsonb :realm_type
|
||||
t.boolean :is_tournament
|
||||
t.integer :realm_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wow_realms, :realm_id, unique: true
|
||||
end
|
||||
end
|
||||
19
db/migrate/20210422192043_create_wow_races.rb
Normal file
19
db/migrate/20210422192043_create_wow_races.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateWowRaces < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_races do |t|
|
||||
t.jsonb :name
|
||||
t.string :href
|
||||
t.string :faction
|
||||
t.jsonb :translated_faction
|
||||
t.boolean :is_selectable
|
||||
t.boolean :is_allied_race
|
||||
t.jsonb :male_name
|
||||
t.jsonb :female_name
|
||||
t.integer :race_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wow_races, :race_id, unique: true
|
||||
end
|
||||
end
|
||||
16
db/migrate/20210422192154_create_wow_classes.rb
Normal file
16
db/migrate/20210422192154_create_wow_classes.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateWowClasses < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_classes do |t|
|
||||
t.jsonb :name
|
||||
t.string :href
|
||||
t.jsonb :male_name
|
||||
t.jsonb :female_name
|
||||
t.jsonb :power_type
|
||||
t.integer :class_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wow_classes, :class_id, unique: true
|
||||
end
|
||||
end
|
||||
15
db/migrate/20210422193149_create_wow_character_titles.rb
Normal file
15
db/migrate/20210422193149_create_wow_character_titles.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateWowCharacterTitles < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_character_titles do |t|
|
||||
t.jsonb :name
|
||||
t.string :href
|
||||
t.jsonb :male_name
|
||||
t.jsonb :female_name
|
||||
t.integer :title_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wow_character_titles, :title_id, unique: true
|
||||
end
|
||||
end
|
||||
28
db/migrate/20210422193343_create_wow_characters.rb
Normal file
28
db/migrate/20210422193343_create_wow_characters.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class CreateWowCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_characters do |t|
|
||||
t.belongs_to :user
|
||||
t.belongs_to :wow_realm
|
||||
t.belongs_to :wow_class
|
||||
t.belongs_to :wow_race
|
||||
t.belongs_to :wow_character_title
|
||||
t.string :name
|
||||
t.string :gender
|
||||
t.jsonb :translated_gender
|
||||
t.string :faction
|
||||
t.jsonb :translated_faction
|
||||
t.integer :character_id, null: false
|
||||
t.integer :level
|
||||
t.integer :account_id
|
||||
t.integer :achievements_points
|
||||
t.timestamp :last_login_timestamp
|
||||
t.integer :average_item_level
|
||||
t.integer :equipped_item_level
|
||||
t.string :href
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :wow_characters, :character_id, unique: true
|
||||
end
|
||||
end
|
||||
14
db/migrate/20210422193459_create_wow_character_media.rb
Normal file
14
db/migrate/20210422193459_create_wow_character_media.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateWowCharacterMedia < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :wow_character_media do |t|
|
||||
t.belongs_to :wow_character
|
||||
t.string :avatar
|
||||
t.string :inset
|
||||
t.string :main
|
||||
t.string :main_raw
|
||||
t.string :href
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
152
db/schema.rb
generated
Normal file
152
db/schema.rb
generated
Normal file
@@ -0,0 +1,152 @@
|
||||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
#
|
||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||
# be faster and is potentially less error prone than running all of your
|
||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||
# migrations use external dependencies or application code.
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_04_22_193459) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "mobility_string_translations", force: :cascade do |t|
|
||||
t.string "locale", null: false
|
||||
t.string "key", null: false
|
||||
t.string "value"
|
||||
t.string "translatable_type"
|
||||
t.bigint "translatable_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["translatable_id", "translatable_type", "key"], name: "index_mobility_string_translations_on_translatable_attribute"
|
||||
t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_string_translations_on_keys", unique: true
|
||||
t.index ["translatable_type", "key", "value", "locale"], name: "index_mobility_string_translations_on_query_keys"
|
||||
end
|
||||
|
||||
create_table "mobility_text_translations", force: :cascade do |t|
|
||||
t.string "locale", null: false
|
||||
t.string "key", null: false
|
||||
t.text "value"
|
||||
t.string "translatable_type"
|
||||
t.bigint "translatable_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["translatable_id", "translatable_type", "key"], name: "index_mobility_text_translations_on_translatable_attribute"
|
||||
t.index ["translatable_id", "translatable_type", "locale", "key"], name: "index_mobility_text_translations_on_keys", unique: true
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email"
|
||||
t.string "encrypted_password"
|
||||
t.datetime "remember_created_at"
|
||||
t.string "battletag", null: false
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
t.boolean "token_expires"
|
||||
t.datetime "token_expire_at"
|
||||
t.string "token"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["battletag"], name: "index_users_on_battletag", unique: true
|
||||
end
|
||||
|
||||
create_table "wow_character_media", force: :cascade do |t|
|
||||
t.bigint "wow_character_id"
|
||||
t.string "avatar"
|
||||
t.string "inset"
|
||||
t.string "main"
|
||||
t.string "main_raw"
|
||||
t.string "href"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["wow_character_id"], name: "index_wow_character_media_on_wow_character_id"
|
||||
end
|
||||
|
||||
create_table "wow_character_titles", force: :cascade do |t|
|
||||
t.jsonb "name"
|
||||
t.string "href"
|
||||
t.jsonb "male_name"
|
||||
t.jsonb "female_name"
|
||||
t.integer "title_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["title_id"], name: "index_wow_character_titles_on_title_id", unique: true
|
||||
end
|
||||
|
||||
create_table "wow_characters", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.bigint "wow_realm_id"
|
||||
t.bigint "wow_class_id"
|
||||
t.bigint "wow_race_id"
|
||||
t.bigint "wow_character_title_id"
|
||||
t.string "name"
|
||||
t.string "gender"
|
||||
t.jsonb "translated_gender"
|
||||
t.string "faction"
|
||||
t.jsonb "translated_faction"
|
||||
t.integer "character_id", null: false
|
||||
t.integer "level"
|
||||
t.integer "account_id"
|
||||
t.integer "achievements_points"
|
||||
t.datetime "last_login_timestamp"
|
||||
t.integer "average_item_level"
|
||||
t.integer "equipped_item_level"
|
||||
t.string "href"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
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"
|
||||
t.index ["wow_class_id"], name: "index_wow_characters_on_wow_class_id"
|
||||
t.index ["wow_race_id"], name: "index_wow_characters_on_wow_race_id"
|
||||
t.index ["wow_realm_id"], name: "index_wow_characters_on_wow_realm_id"
|
||||
end
|
||||
|
||||
create_table "wow_classes", force: :cascade do |t|
|
||||
t.jsonb "name"
|
||||
t.string "href"
|
||||
t.jsonb "male_name"
|
||||
t.jsonb "female_name"
|
||||
t.jsonb "power_type"
|
||||
t.integer "class_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["class_id"], name: "index_wow_classes_on_class_id", unique: true
|
||||
end
|
||||
|
||||
create_table "wow_races", force: :cascade do |t|
|
||||
t.jsonb "name"
|
||||
t.string "href"
|
||||
t.string "faction"
|
||||
t.jsonb "translated_faction"
|
||||
t.boolean "is_selectable"
|
||||
t.boolean "is_allied_race"
|
||||
t.jsonb "male_name"
|
||||
t.jsonb "female_name"
|
||||
t.integer "race_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["race_id"], name: "index_wow_races_on_race_id", unique: true
|
||||
end
|
||||
|
||||
create_table "wow_realms", force: :cascade do |t|
|
||||
t.jsonb "name"
|
||||
t.string "href"
|
||||
t.string "slug"
|
||||
t.jsonb "category"
|
||||
t.string "locale"
|
||||
t.string "timezone"
|
||||
t.jsonb "realm_type"
|
||||
t.boolean "is_tournament"
|
||||
t.integer "realm_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["realm_id"], name: "index_wow_realms_on_realm_id", unique: true
|
||||
end
|
||||
|
||||
end
|
||||
7
db/seeds.rb
Normal file
7
db/seeds.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||
# Character.create(name: 'Luke', movie: movies.first)
|
||||
Reference in New Issue
Block a user