Merge branch 'staging' into summon-renewal

This commit is contained in:
Justin Edmund 2023-01-22 23:12:57 -08:00 committed by GitHub
commit ee7085f65e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 324 additions and 216 deletions

View file

@ -46,6 +46,9 @@ gem 'will_paginate', '~> 3.3'
# Migrate and update data alongside your database structure. # Migrate and update data alongside your database structure.
gem 'data_migrate' gem 'data_migrate'
# A ruby gem to allow the copying of ActiveRecord objects and their associated children, configurable with a DSL on the model
gem 'amoeba'
group :doc do group :doc do
gem 'apipie-rails' gem 'apipie-rails'
gem 'sdoc' gem 'sdoc'

View file

@ -67,6 +67,8 @@ GEM
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
amazing_print (1.4.0) amazing_print (1.4.0)
amoeba (3.2.0)
activerecord (>= 4.2.0)
api_matchers (0.6.2) api_matchers (0.6.2)
activesupport (>= 3.2.5) activesupport (>= 3.2.5)
nokogiri (>= 1.5.2) nokogiri (>= 1.5.2)
@ -305,6 +307,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
amazing_print amazing_print
amoeba
api_matchers api_matchers
apipie-rails apipie-rails
awesome_nested_set awesome_nested_set

View file

@ -8,12 +8,9 @@ module Api
before_action :set, only: %w[update destroy] before_action :set, only: %w[update destroy]
def create def create
party = Party.new(shortcode: random_string) party = Party.new
party.user = current_user if current_user party.user = current_user if current_user
party.attributes = party_params if party_params
if party_params
party.attributes = party_params
end
# unless party_params.empty? # unless party_params.empty?
# party.attributes = party_params # party.attributes = party_params
@ -57,6 +54,22 @@ module Api
return render json: PartyBlueprint.render(@party, view: :destroyed, root: :checkin) if @party.destroy return render json: PartyBlueprint.render(@party, view: :destroyed, root: :checkin) if @party.destroy
end end
def remix
new_party = @party.amoeba_dup
new_party.attributes = {
user: current_user,
name: remixed_name(@party.name),
source_party: @party
}
if new_party.save
render json: PartyBlueprint.render(new_party, view: :full, root: :party,
meta: { remix: true })
else
render_validation_error_response(new_party)
end
end
def index def index
conditions = build_conditions(request.params) conditions = build_conditions(request.params)
@ -111,7 +124,7 @@ module Api
def build_conditions(params) def build_conditions(params)
unless params['recency'].blank? unless params['recency'].blank?
start_time = (DateTime.current - params['recency'].to_i.seconds) start_time = (DateTime.current - params['recency'].to_i.seconds)
.to_datetime.beginning_of_day .to_datetime.beginning_of_day
end end
{}.tap do |hash| {}.tap do |hash|
@ -122,15 +135,31 @@ module Api
end end
end end
def random_string def remixed_name(name)
num_chars = 6 blanked_name = {
o = [('a'..'z'), ('A'..'Z'), (0..9)].map(&:to_a).flatten en: name.blank? ? 'Untitled team' : name,
(0...num_chars).map { o[rand(o.length)] }.join ja: name.blank? ? '無名の編成' : name
}
if current_user
case current_user.language
when 'en'
"Remix of #{blanked_name[:en]}"
when 'ja'
"#{blanked_name[:ja]}のリミックス"
end
else
"Remix of #{blanked_name[:en]}"
end
end end
def set_from_slug def set_from_slug
@party = Party.where('shortcode = ?', params[:id]).first @party = Party.where('shortcode = ?', params[:id]).first
@party.favorited = current_user && @party ? @party.is_favorited(current_user) : false if @party
@party.favorited = current_user && @party ? @party.is_favorited(current_user) : false
else
render_not_found_response('party')
end
end end
def set def set
@ -138,6 +167,8 @@ module Api
end end
def party_params def party_params
return unless params[:party].present?
params.require(:party).permit( params.require(:party).permit(
:user_id, :user_id,
:extra, :extra,
@ -156,7 +187,7 @@ module Api
:button_count, :button_count,
:turn_count, :turn_count,
:chain_count :chain_count
) if params[:party].present? )
end end
end end
end end

View file

@ -1,7 +1,10 @@
# frozen_string_literal: true # frozen_string_literal: true
class GridCharacter < ApplicationRecord class GridCharacter < ApplicationRecord
belongs_to :party belongs_to :party,
counter_cache: :weapons_count,
inverse_of: :characters
validates_presence_of :party
validate :awakening_level, on: :update validate :awakening_level, on: :update
validate :transcendence, on: :update validate :transcendence, on: :update
@ -9,6 +12,16 @@ class GridCharacter < ApplicationRecord
validate :validate_aetherial_mastery_value, on: :update validate :validate_aetherial_mastery_value, on: :update
validate :over_mastery_attack_matches_hp, on: :update validate :over_mastery_attack_matches_hp, on: :update
##### Amoeba configuration
amoeba do
set ring1: { modifier: nil, strength: nil }
set ring2: { modifier: nil, strength: nil }
set ring3: { modifier: nil, strength: nil }
set ring4: { modifier: nil, strength: nil }
set earring: { modifier: nil, strength: nil }
set perpetuity: false
end
def awakening_level def awakening_level
return if awakening.nil? return if awakening.nil?

View file

@ -1,7 +1,10 @@
# frozen_string_literal: true # frozen_string_literal: true
class GridSummon < ApplicationRecord class GridSummon < ApplicationRecord
belongs_to :party belongs_to :party,
counter_cache: :weapons_count,
inverse_of: :summons
validates_presence_of :party
validate :compatible_with_position, on: :create validate :compatible_with_position, on: :create
validate :no_conflicts, on: :create validate :no_conflicts, on: :create

View file

@ -2,7 +2,9 @@
class GridWeapon < ApplicationRecord class GridWeapon < ApplicationRecord
belongs_to :party, belongs_to :party,
counter_cache: :weapons_count counter_cache: :weapons_count,
inverse_of: :weapons
validates_presence_of :party
belongs_to :weapon_key1, class_name: 'WeaponKey', foreign_key: :weapon_key1_id, optional: true belongs_to :weapon_key1, class_name: 'WeaponKey', foreign_key: :weapon_key1_id, optional: true
belongs_to :weapon_key2, class_name: 'WeaponKey', foreign_key: :weapon_key2_id, optional: true belongs_to :weapon_key2, class_name: 'WeaponKey', foreign_key: :weapon_key2_id, optional: true
@ -11,6 +13,14 @@ class GridWeapon < ApplicationRecord
validate :compatible_with_position, on: :create validate :compatible_with_position, on: :create
validate :no_conflicts, on: :create validate :no_conflicts, on: :create
##### Amoeba configuration
amoeba do
nullify :ax_modifier1
nullify :ax_modifier2
nullify :ax_strength1
nullify :ax_strength2
end
# Helper methods # Helper methods
def blueprint def blueprint
GridWeaponBlueprint GridWeaponBlueprint
@ -29,6 +39,8 @@ class GridWeapon < ApplicationRecord
return unless weapon.limit return unless weapon.limit
party.weapons.find do |party_weapon| party.weapons.find do |party_weapon|
return unless party_weapon.id
id_match = weapon.id == party_weapon.id id_match = weapon.id == party_weapon.id
series_match = weapon.series == party_weapon.weapon.series series_match = weapon.series == party_weapon.weapon.series
both_opus_or_draconic = weapon.opus_or_draconic? && party_weapon.weapon.opus_or_draconic? both_opus_or_draconic = weapon.opus_or_draconic? && party_weapon.weapon.opus_or_draconic?

View file

@ -2,6 +2,16 @@
class Party < ApplicationRecord class Party < ApplicationRecord
##### ActiveRecord Associations ##### ActiveRecord Associations
belongs_to :source_party,
class_name: 'Party',
foreign_key: :source_party_id,
optional: true
has_many :derivative_parties,
class_name: 'Party',
foreign_key: :source_party_id,
inverse_of: :source_party
belongs_to :user, optional: true belongs_to :user, optional: true
belongs_to :raid, optional: true belongs_to :raid, optional: true
belongs_to :job, optional: true belongs_to :job, optional: true
@ -29,20 +39,35 @@ class Party < ApplicationRecord
has_many :characters, has_many :characters,
foreign_key: 'party_id', foreign_key: 'party_id',
class_name: 'GridCharacter', class_name: 'GridCharacter',
dependent: :destroy dependent: :destroy,
inverse_of: :party
has_many :weapons, has_many :weapons,
foreign_key: 'party_id', foreign_key: 'party_id',
class_name: 'GridWeapon', class_name: 'GridWeapon',
dependent: :destroy dependent: :destroy,
inverse_of: :party
has_many :summons, has_many :summons,
foreign_key: 'party_id', foreign_key: 'party_id',
class_name: 'GridSummon', class_name: 'GridSummon',
dependent: :destroy dependent: :destroy,
inverse_of: :party
has_many :favorites has_many :favorites
before_create :set_shortcode
##### Amoeba configuration
amoeba do
nullify :description
nullify :shortcode
include_association :characters
include_association :weapons
include_association :summons
end
##### ActiveRecord Validations ##### ActiveRecord Validations
validate :skills_are_unique validate :skills_are_unique
@ -58,6 +83,16 @@ class Party < ApplicationRecord
private private
def set_shortcode
self.shortcode = random_string
end
def random_string
num_chars = 6
o = [('a'..'z'), ('A'..'Z'), (0..9)].map(&:to_a).flatten
(0...num_chars).map { o[rand(o.length)] }.join
end
def skills_are_unique def skills_are_unique
skills = [skill0, skill1, skill2, skill3].compact skills = [skill0, skill1, skill2, skill3].compact

View file

@ -17,6 +17,7 @@ Rails.application.routes.draw do
get 'parties/favorites', to: 'parties#favorites' get 'parties/favorites', to: 'parties#favorites'
get 'parties/:id', to: 'parties#show' get 'parties/:id', to: 'parties#show'
post 'parties/:id/remix', to: 'parties#remix'
put 'parties/:id/jobs', to: 'jobs#update_job' put 'parties/:id/jobs', to: 'jobs#update_job'
put 'parties/:id/job_skills', to: 'jobs#update_job_skills' put 'parties/:id/job_skills', to: 'jobs#update_job_skills'

View file

@ -0,0 +1,7 @@
class AddSourcePartyToParties < ActiveRecord::Migration[7.0]
def change
change_table(:parties) do |t|
t.references :source_party, type: :uuid, foreign_key: { to_table: 'parties' }
end
end
end

View file

@ -10,172 +10,172 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_01_23_035602) do ActiveRecord::Schema[7.0].define(version: 20_230_108_150_956) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "btree_gin" enable_extension 'btree_gin'
enable_extension "pg_trgm" enable_extension 'pg_trgm'
enable_extension "pgcrypto" enable_extension 'pgcrypto'
enable_extension "plpgsql" enable_extension 'plpgsql'
create_table "characters", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'characters', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name_en" t.string 'name_en'
t.string "name_jp" t.string 'name_jp'
t.string "granblue_id" t.string 'granblue_id'
t.integer "rarity" t.integer 'rarity'
t.integer "element" t.integer 'element'
t.integer "proficiency1" t.integer 'proficiency1'
t.integer "proficiency2" t.integer 'proficiency2'
t.integer "gender" t.integer 'gender'
t.integer "race1" t.integer 'race1'
t.integer "race2" t.integer 'race2'
t.boolean "flb", default: false, null: false t.boolean 'flb', default: false, null: false
t.integer "min_hp" t.integer 'min_hp'
t.integer "max_hp" t.integer 'max_hp'
t.integer "max_hp_flb" t.integer 'max_hp_flb'
t.integer "min_atk" t.integer 'min_atk'
t.integer "max_atk" t.integer 'max_atk'
t.integer "max_atk_flb" t.integer 'max_atk_flb'
t.integer "base_da" t.integer 'base_da'
t.integer "base_ta" t.integer 'base_ta'
t.float "ougi_ratio" t.float 'ougi_ratio'
t.float "ougi_ratio_flb" t.float 'ougi_ratio_flb'
t.boolean "special", default: false, null: false t.boolean 'special', default: false, null: false
t.boolean "ulb", default: false, null: false t.boolean 'ulb', default: false, null: false
t.integer "max_hp_ulb" t.integer 'max_hp_ulb'
t.integer "max_atk_ulb" t.integer 'max_atk_ulb'
t.integer "character_id", default: [], null: false, array: true t.integer 'character_id', default: [], null: false, array: true
t.index ["name_en"], name: "index_characters_on_name_en", opclass: :gin_trgm_ops, using: :gin t.index ['name_en'], name: 'index_characters_on_name_en', opclass: :gin_trgm_ops, using: :gin
end end
create_table "data_migrations", primary_key: "version", id: :string, force: :cascade do |t| create_table 'data_migrations', primary_key: 'version', id: :string, force: :cascade do |t|
end end
create_table "favorites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'favorites', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "user_id" t.uuid 'user_id'
t.uuid "party_id" t.uuid 'party_id'
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.index ["party_id"], name: "index_favorites_on_party_id" t.index ['party_id'], name: 'index_favorites_on_party_id'
t.index ["user_id"], name: "index_favorites_on_user_id" t.index ['user_id'], name: 'index_favorites_on_user_id'
end end
create_table "grid_characters", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'grid_characters', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "party_id" t.uuid 'party_id'
t.uuid "character_id" t.uuid 'character_id'
t.integer "uncap_level" t.integer 'uncap_level'
t.integer "position" t.integer 'position'
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.boolean "perpetuity", default: false, null: false t.boolean 'perpetuity', default: false, null: false
t.integer "transcendence_step", default: 0, null: false t.integer 'transcendence_step', default: 0, null: false
t.jsonb "ring1", default: {"modifier"=>nil, "strength"=>nil}, null: false t.jsonb 'ring1', default: { 'modifier' => nil, 'strength' => nil }, null: false
t.jsonb "ring2", default: {"modifier"=>nil, "strength"=>nil}, null: false t.jsonb 'ring2', default: { 'modifier' => nil, 'strength' => nil }, null: false
t.jsonb "ring3", default: {"modifier"=>nil, "strength"=>nil}, null: false t.jsonb 'ring3', default: { 'modifier' => nil, 'strength' => nil }, null: false
t.jsonb "ring4", default: {"modifier"=>nil, "strength"=>nil}, null: false t.jsonb 'ring4', default: { 'modifier' => nil, 'strength' => nil }, null: false
t.jsonb "earring", default: {"modifier"=>nil, "strength"=>nil}, null: false t.jsonb 'earring', default: { 'modifier' => nil, 'strength' => nil }, null: false
t.jsonb "awakening", default: {"type"=>1, "level"=>1}, null: false t.jsonb 'awakening', default: { 'type' => 1, 'level' => 1 }, null: false
t.index ["character_id"], name: "index_grid_characters_on_character_id" t.index ['character_id'], name: 'index_grid_characters_on_character_id'
t.index ["party_id"], name: "index_grid_characters_on_party_id" t.index ['party_id'], name: 'index_grid_characters_on_party_id'
end end
create_table "grid_summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'grid_summons', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "party_id" t.uuid 'party_id'
t.uuid "summon_id" t.uuid 'summon_id'
t.integer "uncap_level" t.integer 'uncap_level'
t.boolean "main" t.boolean 'main'
t.boolean "friend" t.boolean 'friend'
t.integer "position" t.integer 'position'
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.integer "transcendence_step", default: 0, null: false t.integer 'transcendence_step', default: 0, null: false
t.index ["party_id"], name: "index_grid_summons_on_party_id" t.index ['party_id'], name: 'index_grid_summons_on_party_id'
t.index ["summon_id"], name: "index_grid_summons_on_summon_id" t.index ['summon_id'], name: 'index_grid_summons_on_summon_id'
end end
create_table "grid_weapons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'grid_weapons', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "party_id" t.uuid 'party_id'
t.uuid "weapon_id" t.uuid 'weapon_id'
t.uuid "weapon_key1_id" t.uuid 'weapon_key1_id'
t.uuid "weapon_key2_id" t.uuid 'weapon_key2_id'
t.integer "uncap_level" t.integer 'uncap_level'
t.boolean "mainhand" t.boolean 'mainhand'
t.integer "position" t.integer 'position'
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.uuid "weapon_key3_id" t.uuid 'weapon_key3_id'
t.integer "ax_modifier1" t.integer 'ax_modifier1'
t.float "ax_strength1" t.float 'ax_strength1'
t.integer "ax_modifier2" t.integer 'ax_modifier2'
t.float "ax_strength2" t.float 'ax_strength2'
t.integer "element" t.integer 'element'
t.integer "awakening_type" t.integer 'awakening_type'
t.integer "awakening_level", default: 1, null: false t.integer 'awakening_level', default: 1, null: false
t.index ["party_id"], name: "index_grid_weapons_on_party_id" t.index ['party_id'], name: 'index_grid_weapons_on_party_id'
t.index ["weapon_id"], name: "index_grid_weapons_on_weapon_id" t.index ['weapon_id'], name: 'index_grid_weapons_on_weapon_id'
end end
create_table "job_skills", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'job_skills', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "job_id" t.uuid 'job_id'
t.string "name_en", null: false t.string 'name_en', null: false
t.string "name_jp", null: false t.string 'name_jp', null: false
t.string "slug", null: false t.string 'slug', null: false
t.integer "color", null: false t.integer 'color', null: false
t.boolean "main", default: false t.boolean 'main', default: false
t.boolean "sub", default: false t.boolean 'sub', default: false
t.boolean "emp", default: false t.boolean 'emp', default: false
t.integer "order" t.integer 'order'
t.boolean "base", default: false t.boolean 'base', default: false
t.index ["job_id"], name: "index_job_skills_on_job_id" t.index ['job_id'], name: 'index_job_skills_on_job_id'
end end
create_table "jobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'jobs', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name_en" t.string 'name_en'
t.string "name_jp" t.string 'name_jp'
t.integer "proficiency1" t.integer 'proficiency1'
t.integer "proficiency2" t.integer 'proficiency2'
t.string "row" t.string 'row'
t.boolean "ml", default: false t.boolean 'ml', default: false
t.integer "order" t.integer 'order'
t.uuid "base_job_id" t.uuid 'base_job_id'
t.index ["base_job_id"], name: "index_jobs_on_base_job_id" t.index ['base_job_id'], name: 'index_jobs_on_base_job_id'
end end
create_table "oauth_access_grants", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'oauth_access_grants', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "resource_owner_id", null: false t.uuid 'resource_owner_id', null: false
t.uuid "application_id", null: false t.uuid 'application_id', null: false
t.string "token", null: false t.string 'token', null: false
t.integer "expires_in", null: false t.integer 'expires_in', null: false
t.text "redirect_uri", null: false t.text 'redirect_uri', null: false
t.datetime "created_at", precision: nil, null: false t.datetime 'created_at', precision: nil, null: false
t.datetime "revoked_at", precision: nil t.datetime 'revoked_at', precision: nil
t.string "scopes" t.string 'scopes'
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true t.index ['token'], name: 'index_oauth_access_grants_on_token', unique: true
end end
create_table "oauth_access_tokens", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'oauth_access_tokens', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.uuid "resource_owner_id" t.uuid 'resource_owner_id'
t.uuid "application_id" t.uuid 'application_id'
t.string "token", null: false t.string 'token', null: false
t.string "refresh_token" t.string 'refresh_token'
t.integer "expires_in" t.integer 'expires_in'
t.datetime "revoked_at", precision: nil t.datetime 'revoked_at', precision: nil
t.datetime "created_at", precision: nil, null: false t.datetime 'created_at', precision: nil, null: false
t.string "scopes" t.string 'scopes'
t.string "previous_refresh_token", default: "", null: false t.string 'previous_refresh_token', default: '', null: false
t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true t.index ['refresh_token'], name: 'index_oauth_access_tokens_on_refresh_token', unique: true
t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" t.index ['resource_owner_id'], name: 'index_oauth_access_tokens_on_resource_owner_id'
t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true t.index ['token'], name: 'index_oauth_access_tokens_on_token', unique: true
end end
create_table "oauth_applications", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'oauth_applications', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name", null: false t.string 'name', null: false
t.string "uid", null: false t.string 'uid', null: false
t.string "secret", null: false t.string 'secret', null: false
t.text "redirect_uri", null: false t.text 'redirect_uri', null: false
t.string "scopes", default: "", null: false t.string 'scopes', default: '', null: false
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true t.index ['uid'], name: 'index_oauth_applications_on_uid', unique: true
end end
create_table "parties", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table "parties", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
@ -212,13 +212,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_23_035602) do
t.index ["user_id"], name: "index_parties_on_user_id" t.index ["user_id"], name: "index_parties_on_user_id"
end end
create_table "raids", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'raids', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name_en" t.string 'name_en'
t.string "name_jp" t.string 'name_jp'
t.integer "level" t.integer 'level'
t.integer "group" t.integer 'group'
t.integer "element" t.integer 'element'
t.string "slug" t.string 'slug'
end end
create_table "summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table "summons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
@ -247,57 +247,57 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_23_035602) do
t.index ["name_en"], name: "index_summons_on_name_en", opclass: :gin_trgm_ops, using: :gin t.index ["name_en"], name: "index_summons_on_name_en", opclass: :gin_trgm_ops, using: :gin
end end
create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'users', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "email" t.string 'email'
t.string "password_digest" t.string 'password_digest'
t.string "username" t.string 'username'
t.integer "granblue_id" t.integer 'granblue_id'
t.datetime "created_at", null: false t.datetime 'created_at', null: false
t.datetime "updated_at", null: false t.datetime 'updated_at', null: false
t.string "picture", default: "gran" t.string 'picture', default: 'gran'
t.string "language", default: "en", null: false t.string 'language', default: 'en', null: false
t.boolean "private", default: false, null: false t.boolean 'private', default: false, null: false
t.string "element", default: "water", null: false t.string 'element', default: 'water', null: false
t.integer "gender", default: 0, null: false t.integer 'gender', default: 0, null: false
t.string "theme", default: "system", null: false t.string 'theme', default: 'system', null: false
end end
create_table "weapon_keys", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'weapon_keys', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name_en" t.string 'name_en'
t.string "name_jp" t.string 'name_jp'
t.integer "series" t.integer 'series'
t.integer "slot" t.integer 'slot'
t.integer "group" t.integer 'group'
t.integer "order" t.integer 'order'
t.string "slug" t.string 'slug'
end end
create_table "weapons", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| create_table 'weapons', id: :uuid, default: -> { 'gen_random_uuid()' }, force: :cascade do |t|
t.string "name_en" t.string 'name_en'
t.string "name_jp" t.string 'name_jp'
t.string "granblue_id" t.string 'granblue_id'
t.integer "rarity" t.integer 'rarity'
t.integer "element" t.integer 'element'
t.integer "proficiency" t.integer 'proficiency'
t.integer "series", default: -1, null: false t.integer 'series', default: -1, null: false
t.boolean "flb", default: false, null: false t.boolean 'flb', default: false, null: false
t.boolean "ulb", default: false, null: false t.boolean 'ulb', default: false, null: false
t.integer "max_level", default: 100, null: false t.integer 'max_level', default: 100, null: false
t.integer "max_skill_level", default: 10, null: false t.integer 'max_skill_level', default: 10, null: false
t.integer "min_hp" t.integer 'min_hp'
t.integer "max_hp" t.integer 'max_hp'
t.integer "max_hp_flb" t.integer 'max_hp_flb'
t.integer "max_hp_ulb" t.integer 'max_hp_ulb'
t.integer "min_atk" t.integer 'min_atk'
t.integer "max_atk" t.integer 'max_atk'
t.integer "max_atk_flb" t.integer 'max_atk_flb'
t.integer "max_atk_ulb" t.integer 'max_atk_ulb'
t.boolean "extra", default: false, null: false t.boolean 'extra', default: false, null: false
t.integer "ax_type" t.integer 'ax_type'
t.boolean "awakening", default: true, null: false t.boolean 'awakening', default: true, null: false
t.boolean "limit", default: false, null: false t.boolean 'limit', default: false, null: false
t.boolean "ax", default: false, null: false t.boolean 'ax', default: false, null: false
t.index ["name_en"], name: "index_weapons_on_name_en", opclass: :gin_trgm_ops, using: :gin t.index ['name_en'], name: 'index_weapons_on_name_en', opclass: :gin_trgm_ops, using: :gin
end end
add_foreign_key "favorites", "parties" add_foreign_key "favorites", "parties"