Update awakenings (#101)

* Deploy unauthenticated profile fix (#93)

* Implements advanced filters (#90)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix a bug where unauthenticated users couldn't view profiles (#92)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix being unable to see profiles when unauth

* Add tables used for Siero's revival (#94)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Deploy unauthenticated profile fix (#93)

* Implements advanced filters (#90)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix a bug where unauthenticated users couldn't view profiles (#92)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix being unable to see profiles when unauth

* Add guidebooks migration

* Implement business logic for reading Guidebooks

* Change to individual guidebook columns

* Properly output guidebook description

* Move to 1-index guidebooks

* Update party-related files for 1-index guidebooks

* Add tables for Siero

* Adds guidebooks and gacha tables (#95)

* Implements advanced filters (#90)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix a bug where unauthenticated users couldn't view profiles (#92)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix being unable to see profiles when unauth

* Add tables used for Siero's revival (#94)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Deploy unauthenticated profile fix (#93)

* Implements advanced filters (#90)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix a bug where unauthenticated users couldn't view profiles (#92)

* Implements advanced filters (#90) (#91)

* Add advanced filters

Adds new filters to search:

* Full auto
* Charge attack
* Auto guard
* Number of weapons (user-selectable now)
* Number of summons
* Number of characters
* Maximum number of turns
* Maximum number of buttons
* Maximum clear time
* User quality (No anonymous users)
* Name quality (No untitled teams)
* Remixes (Only show original teams)

* Update advanced filter params

* Add default to party counter cache

* Fix being unable to see profiles when unauth

* Add guidebooks migration

* Implement business logic for reading Guidebooks

* Change to individual guidebook columns

* Properly output guidebook description

* Move to 1-index guidebooks

* Update party-related files for 1-index guidebooks

* Add tables for Siero

* Update download and export scripts

* Support for Siero, raids rework and edit party rework (#96)

* Add guidebooks migration

* Implement business logic for reading Guidebooks

* Change to individual guidebook columns

* Properly output guidebook description

* Move to 1-index guidebooks

* Update party-related files for 1-index guidebooks

* Add tables for Siero

* Add raid groups table

* Update raid model

To belong to the RaidGroup class

* Update job class

To have many job skills

* Add endpoint for raid groups

* Update Raid blueprint with views

* Added down for creating table

* Add guidebooks flag and auto summon flag

* Guidebooks → RaidGroup
* Auto summon → Party

* Add views to Raid blueprint

* Add views and guidebook flag to RaidGroup blueprint

* Add auto summon and Raid view to Party blueprint

* Remove ap call

* Add quick summons (#97)

* Adds quick summon migration
* Add route to update quick summon
* Add logic to update quick summon

* Add logic to updating summon uncap

You couldn't actually update summon transcendence on staging, maybe due to a bug?

Now you can. And it won't let you update outside of the bounds of what is defined on the canonical object.

* Fix summon logic

Updated logic for updating summon uncap and transcendence levels and quick summon status.

* Fix searching in Japanese (#99)

This was broken because we were using the browser-provided locale as a prefix to our method, but that is 'ja' and our methods were prefixed with 'jp'.

* Fix display of base skills (#100)

Base skills were not displaying due to a missing case in our search code. This is now fixed.

* Squash migrations into one file

* Add migrations

This adds migrations and data migrations for the awakening update.

* A new `Awakenings` table now exists that stores all possible awakenings, with a column for object type.
* GridCharacter and GridWeapon now have `awakening_id` and `awakening_level` fields. Their `awakening` and `awakening_type` fields were removed.
* Weapons have a mapping table, `WeaponAwakenings`, as not all weapons can be awakened.
* Data migrations are included to migrate existing user data. They should be run automatically when the migration is run with `rails db:migrate:with_data`

* Add and update models

This updates models for the awakening update.

* Awakening and WeaponAwakening models were added
* Weapon, GridWeapon and GridCharacter models get relationships to the new models defined
* GridCharacter had a validation on `awakening_level` that needed to be fixed

* Update controllers

This updates the GridCharacters and GridWeapons controllers to accept the new fields `awakening_id` and `awakening_level` from clients

* Update blueprints

This updates the blueprints to match the new schema. The new AwakeningBlueprint was accidentally added already, oops.
This commit is contained in:
Justin Edmund 2023-06-19 00:45:27 -07:00 committed by GitHub
parent dfbfada0d0
commit 86196e0fb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
146 changed files with 669 additions and 1054 deletions

View file

@ -66,12 +66,16 @@ end
group :development do
gem 'listen'
gem 'rubocop'
gem 'solargraph'
gem 'spring'
gem 'spring-commands-rspec'
end
group :tools do
gem 'squasher', '>= 0.6.0'
gem 'rubocop'
end
group :test do
gem 'api_matchers'
gem 'byebug'

View file

@ -293,6 +293,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
squasher (0.7.2)
stringio (3.0.4)
thor (1.2.1)
tilt (2.0.11)
@ -349,6 +350,7 @@ DEPENDENCIES
spring
spring-commands-rspec
sprockets-rails
squasher (>= 0.6.0)
will_paginate (~> 3.3)
RUBY VERSION

View file

@ -0,0 +1,16 @@
# frozen_string_literal: true
module Api
module V1
class AwakeningBlueprint < ApiBlueprint
field :name do |w|
{
en: w.name_en,
ja: w.name_jp
}
end
fields :slug, :object_type, :order
end
end
end

View file

@ -63,6 +63,12 @@ module Api
ougi_ratio_flb: w.ougi_ratio_flb
}
end
field :awakenings do
Awakening.where(object_type: 'Character').map do |a|
AwakeningBlueprint.render_as_hash(a)
end
end
end
end
end

View file

@ -18,7 +18,10 @@ module Api
end
field :awakening do |c|
c.awakening
{
type: AwakeningBlueprint.render_as_hash(c.awakening),
level: c.awakening_level
}
end
field :over_mastery, if: lambda { |_fn, obj, _opt|

View file

@ -32,9 +32,9 @@ module Api
end
end
field :awakening, if: ->(_field_name, w, _options) { w.weapon.awakening } do |w|
field :awakening, if: ->(_field_name, w, _options) { w.awakening_id } do |w|
{
type: w.awakening_type,
type: AwakeningBlueprint.render_as_hash(w.awakening),
level: w.awakening_level
}
end

View file

@ -11,8 +11,8 @@ module Api
end
fields :granblue_id, :element, :proficiency,
:max_level, :max_skill_level, :limit, :rarity,
:series, :ax, :ax_type, :awakening
:max_level, :max_skill_level, :max_awakening_level, :limit, :rarity,
:series, :ax, :ax_type
field :uncap do |w|
{
@ -38,6 +38,12 @@ module Api
max_atk_ulb: w.max_atk_ulb
}
end
field :awakenings, if: ->(_field_name, w, _options) { w.awakenings } do |w|
w.awakenings.map do |a|
AwakeningBlueprint.render_as_hash(a)
end
end
end
end
end

View file

@ -147,9 +147,10 @@ module Api
def character_params
params.require(:character).permit(:id, :party_id, :character_id, :position,
:uncap_level, :transcendence_step, :perpetuity,
:awakening_id, :awakening_level,
ring1: %i[modifier strength], ring2: %i[modifier strength],
ring3: %i[modifier strength], ring4: %i[modifier strength],
earring: %i[modifier strength], awakening: %i[type level])
earring: %i[modifier strength])
end
def resolve_params

View file

@ -198,7 +198,7 @@ module Api
:position, :mainhand, :uncap_level, :element,
:weapon_key1_id, :weapon_key2_id, :weapon_key3_id,
:ax_modifier1, :ax_modifier2, :ax_strength1, :ax_strength2,
:awakening_type, :awakening_level
:awakening_id, :awakening_level
)
end

15
app/models/awakening.rb Normal file
View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
class Awakening < ApplicationRecord
def weapon_awakenings
WeaponAwakening.where(awakening_id: id)
end
def weapons
weapon_awakenings.map(&:weapon)
end
def awakening
AwakeningBlueprint
end
end

View file

@ -1,12 +1,13 @@
# frozen_string_literal: true
class GridCharacter < ApplicationRecord
belongs_to :awakening, optional: true
belongs_to :party,
counter_cache: :characters_count,
inverse_of: :characters
validates_presence_of :party
validate :awakening_level, on: :update
validate :validate_awakening_level, on: :update
validate :transcendence, on: :update
validate :validate_over_mastery_values, on: :update
validate :validate_aetherial_mastery_value, on: :update
@ -22,11 +23,9 @@ class GridCharacter < ApplicationRecord
set perpetuity: false
end
def awakening_level
return if awakening.nil?
errors.add(:awakening, 'awakening level too low') if awakening['level'] < 1
errors.add(:awakening, 'awakening level too high') if awakening['level'] > 9
def validate_awakening_level
errors.add(:awakening, 'awakening level too low') if awakening_level < 1
errors.add(:awakening, 'awakening level too high') if awakening_level > 9
end
def transcendence

View file

@ -10,6 +10,8 @@ class GridWeapon < ApplicationRecord
belongs_to :weapon_key2, class_name: 'WeaponKey', foreign_key: :weapon_key2_id, optional: true
belongs_to :weapon_key3, class_name: 'WeaponKey', foreign_key: :weapon_key3_id, optional: true
belongs_to :awakening, optional: true
validate :compatible_with_position, on: :create
validate :no_conflicts, on: :create

View file

@ -20,6 +20,9 @@ class Weapon < ApplicationRecord
}
}
has_many :weapon_awakenings
has_many :awakenings, through: :weapon_awakenings
def blueprint
WeaponBlueprint
end

View file

@ -0,0 +1,14 @@
# frozen_string_literal: true
class WeaponAwakening < ApplicationRecord
belongs_to :weapon
belongs_to :awakening
def weapon
Weapon.find(weapon_id)
end
def awakening
Awakening.find(awakening_id)
end
end

27
bin/squasher Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'squasher' is installed as part of a gem, and
# this file is here to facilitate running it.
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("squasher", "squasher")

View file

@ -1,20 +0,0 @@
# frozen_string_literal: true
class MigrateAxTypeToAx < ActiveRecord::Migration[6.1]
def up
Weapon.all.each do |weapon|
if weapon.ax_type > 0
weapon.ax = true
elsif weapon.ax_type == 0
weapon.ax = false
weapon.ax_type = nil
end
weapon.save
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -1,21 +0,0 @@
# frozen_string_literal: true
class SetFlbToFalseOnSummons < ActiveRecord::Migration[6.1]
def up
Summon.all.each do |summon|
if summon.flb.nil?
summon.flb = false
summon.save
end
if summon.ulb.nil?
summon.ulb = false
summon.save
end
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -0,0 +1,28 @@
# frozen_string_literal: true
class MigrateAwakeningTypeToNewAwakeningType < ActiveRecord::Migration[7.0]
def up
GridWeapon.all.each do |weapon|
if weapon.awakening_type&.positive? && weapon.awakening_type <= 3
slug = if weapon.awakening_type == 1
'weapon-atk'
elsif weapon.awakening_type == 2
'weapon-def'
elsif weapon.awakening_type == 3
'weapon-special'
end
ap "#{weapon.weapon.name_en}: #{slug}"
new_awakening = Awakening.find_by(slug: slug)
weapon.awakening_id = new_awakening.id
ap weapon.awakening_id
weapon.save!
end
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -0,0 +1,30 @@
# frozen_string_literal: true
class MigrateCharacterAwakeningTypeToNewAwakeningType < ActiveRecord::Migration[7.0]
def up
GridCharacter.all.each do |character|
slug = if character.awakening['type'] == 0
'character-balanced'
elsif character.awakening['type'] == 1
'character-atk'
elsif character.awakening['type'] == 2
'character-def'
elsif character.awakening['type'] == 3
'character-multi'
else
'character-balanced'
end
new_awakening = Awakening.find_by(slug: slug)
character.awakening_id = new_awakening.id
character.awakening_level = character.awakening['level']
character.save!(validate: false)
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -1 +1 @@
DataMigrate::Data.define(version: 20230102235227)
DataMigrate::Data.define(version: 20230619043726)

View file

@ -1,5 +0,0 @@
class EnablePgcryptoExtension < ActiveRecord::Migration[5.0]
def change
enable_extension 'pgcrypto'
end
end

View file

@ -1,12 +0,0 @@
class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :email, :unique => true
t.string :password_digest
t.string :username, :unique => true
t.integer :granblue_id, :unique => true
t.timestamps
end
end
end

View file

@ -1,28 +0,0 @@
class CreateWeapons < ActiveRecord::Migration[6.0]
def change
create_table :weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.string :granblue_id
t.integer :rarity
t.integer :element
t.integer :proficiency
t.string :series
t.boolean :flb
t.boolean :ulb
t.integer :max_level
t.integer :max_skill_level
t.integer :min_hp
t.integer :max_hp
t.integer :max_hp_flb
t.integer :max_hp_ulb
t.integer :min_atk
t.integer :max_atk
t.integer :max_atk_flb
t.integer :max_atk_ulb
end
end
end

View file

@ -1,11 +0,0 @@
class CreateParties < ActiveRecord::Migration[6.0]
def change
create_table :parties, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :user, type: :uuid
t.string :shortcode
t.timestamps
end
end
end

View file

@ -1,17 +0,0 @@
class CreateGridWeapons < ActiveRecord::Migration[6.0]
def change
create_table :grid_weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :party, type: :uuid
t.references :weapon, type: :uuid
t.references :weapon_key1, class_name: 'WeaponKey', type: :uuid
t.references :weapon_key2, class_name: 'WeaponKey', type: :uuid
t.integer :uncap_level
t.boolean :mainhand
t.integer :position
t.timestamps
end
end
end

View file

@ -1,13 +0,0 @@
class CreateWeaponKeys < ActiveRecord::Migration[6.0]
def change
create_table :weapon_keys, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.integer :series
t.integer :type
t.timestamps
end
end
end

View file

@ -1,70 +0,0 @@
# frozen_string_literal: true
class CreateDoorkeeperTables < ActiveRecord::Migration[6.0]
def change
create_table :oauth_applications, id: :uuid do |t|
t.string :name, null: false
t.string :uid, null: false
t.string :secret, null: false
t.text :redirect_uri, null: false
t.string :scopes, null: false, default: ''
t.timestamps null: false
end
add_index :oauth_applications, :uid, unique: true
create_table :oauth_access_grants, id: :uuid do |t|
t.uuid :resource_owner_id, null: false
t.uuid :application_id, null: false
t.string :token, null: false
t.integer :expires_in, null: false
t.text :redirect_uri, null: false
t.datetime :created_at, null: false
t.datetime :revoked_at
t.string :scopes
end
add_index :oauth_access_grants, :token, unique: true
add_foreign_key(
:oauth_access_grants,
:oauth_applications,
column: :application_id
)
create_table :oauth_access_tokens, id: :uuid do |t|
t.uuid :resource_owner_id
t.uuid :application_id
# If you use a custom token generator you may need to change this column
# from string to text, so that it accepts tokens larger than 255
# characters. More info on custom token generators in:
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
#
# t.text :token, null: false
t.string :token, null: false
t.string :refresh_token
t.integer :expires_in
t.datetime :revoked_at
t.datetime :created_at, null: false
t.string :scopes
# If there is a previous_refresh_token column,
# refresh tokens will be revoked after a related access token is used.
# If there is no previous_refresh_token column,
# previous tokens are revoked as soon as a new access token is created.
# Comment out this line if you'd rather have refresh tokens
# instantly revoked.
t.string :previous_refresh_token, null: false, default: ""
end
add_index :oauth_access_tokens, :token, unique: true
add_index :oauth_access_tokens, :resource_owner_id
add_index :oauth_access_tokens, :refresh_token, unique: true
add_foreign_key(
:oauth_access_tokens,
:oauth_applications,
column: :application_id
)
end
end

View file

@ -1,26 +0,0 @@
class CreateSummons < ActiveRecord::Migration[6.0]
def change
create_table :summons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.string :granblue_id
t.integer :rarity
t.integer :element
t.string :series
t.boolean :flb
t.boolean :ulb
t.integer :max_level
t.integer :min_hp
t.integer :max_hp
t.integer :max_hp_flb
t.integer :max_hp_ulb
t.integer :min_atk
t.integer :max_atk
t.integer :max_atk_flb
t.integer :max_atk_ulb
end
end
end

View file

@ -1,15 +0,0 @@
class CreateGridSummons < ActiveRecord::Migration[6.0]
def change
create_table :grid_summons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :party, type: :uuid
t.references :summon, type: :uuid
t.integer :uncap_level
t.boolean :main
t.boolean :friend
t.integer :position
t.timestamps
end
end
end

View file

@ -1,32 +0,0 @@
class CreateCharacters < ActiveRecord::Migration[6.0]
def change
create_table :characters, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.string :granblue_id
t.integer :rarity
t.integer :element
t.integer :proficiency1
t.integer :proficiency2
t.integer :gender
t.integer :race1
t.integer :race2
t.boolean :flb
t.boolean :max_level
t.integer :min_hp
t.integer :max_hp
t.integer :max_hp_flb
t.integer :min_atk
t.integer :max_atk
t.integer :max_atk_flb
t.integer :base_da
t.integer :base_ta
t.float :ougi_ratio
t.float :ougi_ratio_flb
end
end
end

View file

@ -1,13 +0,0 @@
class CreateGridCharacters < ActiveRecord::Migration[6.0]
def change
create_table :grid_characters do |t|
t.references :party, type: :uuid
t.references :character, type: :uuid
t.integer :uncap_level
t.integer :position
t.timestamps
end
end
end

View file

@ -1,5 +0,0 @@
class AddExtraToParty < ActiveRecord::Migration[6.1]
def change
add_column :parties, :extra, :boolean, :default => false, :null => false
end
end

View file

@ -1,5 +0,0 @@
class AddExtraToWeapons < ActiveRecord::Migration[6.1]
def change
add_column :weapons, :extra, :boolean, :default => false, :null => false
end
end

View file

@ -1,5 +0,0 @@
class AddSubauraToSummons < ActiveRecord::Migration[6.1]
def change
add_column :summons, :subaura, :boolean, :default => false, :null => false
end
end

View file

@ -1,5 +0,0 @@
class AddLimitsToWeapons < ActiveRecord::Migration[6.1]
def change
add_column :weapons, :limit, :integer
end
end

View file

@ -1,5 +0,0 @@
class AddLimitsToSummons < ActiveRecord::Migration[6.1]
def change
add_column :summons, :limit, :integer
end
end

View file

@ -1,13 +0,0 @@
class AddDefaultToLbOnWeapons < ActiveRecord::Migration[6.1]
def change
def self.up
change_column :weapons, :flb, :boolean, default: false
change_column :weapons, :ulb, :boolean, default: false
end
def self.down
change_column :weapons, :flb, :boolean, default: nil
change_column :weapons, :ulb, :boolean, default: nil
end
end
end

View file

@ -1,5 +0,0 @@
class AddAxToWeapons < ActiveRecord::Migration[6.1]
def change
add_column :weapons, :ax, :integer
end
end

View file

@ -1,10 +0,0 @@
class AddSpecialToCharacters < ActiveRecord::Migration[6.1]
def up
add_column :characters, :special, :boolean, :default => false
change_column_null :characters, :special, false
end
def down
remove_column :characters, :special, :boolean
end
end

View file

@ -1,15 +0,0 @@
class AddUlbToCharacters < ActiveRecord::Migration[6.1]
def up
add_column :characters, :ulb, :boolean, :default => false
add_column :characters, :max_hp_ulb, :integer
add_column :characters, :max_atk_ulb, :integer
change_column_null :characters, :ulb, false
change_column_null :characters, :flb, false
end
def down
remove_column :characters, :ulb, :boolean
remove_column :characters, :max_hp_ulb, :integer
remove_column :characters, :max_atk_ulb, :integer
end
end

View file

@ -1,5 +0,0 @@
class RemoveMaxLevelFromCharacters < ActiveRecord::Migration[6.1]
def change
remove_column :characters, :max_level, :boolean
end
end

View file

@ -1,5 +0,0 @@
class AddUuidToGridCharacter < ActiveRecord::Migration[6.1]
def change
add_column :grid_characters, :uuid, :uuid, default: "gen_random_uuid()", null: false
end
end

View file

@ -1,10 +0,0 @@
class ChangeGridCharacterIdToUuid < ActiveRecord::Migration[6.1]
def change
change_table :grid_characters do |t|
t.remove :id
t.rename :uuid, :id
end
execute "ALTER TABLE grid_characters ADD PRIMARY KEY (id);"
end
end

View file

@ -1,13 +0,0 @@
class AddDetailsToParty < ActiveRecord::Migration[6.1]
def change
create_table :raids, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.integer :level
end
add_column :parties, :name, :string
add_column :parties, :description, :text
add_reference :parties, :raids, index: true
end
end

View file

@ -1,5 +0,0 @@
class AddGroupToRaids < ActiveRecord::Migration[6.1]
def change
add_column :raids, :group, :integer
end
end

View file

@ -1,6 +0,0 @@
class FixRaidAssociationOnParties < ActiveRecord::Migration[6.1]
def change
add_column :parties, :raid_id, :uuid
remove_column :parties, :raids_id, :bigint
end
end

View file

@ -1,5 +0,0 @@
class AddElementToRaids < ActiveRecord::Migration[6.1]
def change
add_column :raids, :element, :integer
end
end

View file

@ -1,5 +0,0 @@
class AddElementToParties < ActiveRecord::Migration[6.1]
def change
add_column :parties, :element, :integer
end
end

View file

@ -1,9 +0,0 @@
class CreateFavorites < ActiveRecord::Migration[6.1]
def change
create_table :favorites, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :user, type: :uuid
t.references :party, type: :uuid
t.timestamps
end
end
end

View file

@ -1,5 +0,0 @@
class ChangeWeaponSeriesToNumber < ActiveRecord::Migration[6.1]
def change
change_column :weapons, :series, 'integer USING CAST(element AS integer)'
end
end

View file

@ -1,6 +0,0 @@
class RemoveTimestampsFromWeaponKeys < ActiveRecord::Migration[6.1]
def change
remove_column :weapon_keys, :created_at, :datetime
remove_column :weapon_keys, :updated_at, :datetime
end
end

View file

@ -1,5 +0,0 @@
class AddSubTypeToWeaponKeys < ActiveRecord::Migration[6.1]
def change
add_column :weapon_keys, :subtype, :integer
end
end

View file

@ -1,5 +0,0 @@
class AddWeaponKey3ToGridWeapons < ActiveRecord::Migration[6.1]
def change
add_reference :grid_weapons, :weapon_key3, type: :uuid, foreign_key: { to_table: :weapon_keys }
end
end

View file

@ -1,8 +0,0 @@
class AddAxToGridWeapons < ActiveRecord::Migration[6.1]
def change
add_column :grid_weapons, :ax_modifier1, :integer
add_column :grid_weapons, :ax_strength1, :float
add_column :grid_weapons, :ax_modifier2, :integer
add_column :grid_weapons, :ax_strength2, :float
end
end

View file

@ -1,5 +0,0 @@
class AddElementToGridWeapons < ActiveRecord::Migration[6.1]
def change
add_column :grid_weapons, :element, :integer
end
end

View file

@ -1,5 +0,0 @@
class AddPerpetuityToGridCharacters < ActiveRecord::Migration[6.1]
def change
add_column :grid_characters, :perpetuity, :boolean
end
end

View file

@ -1,6 +0,0 @@
class RenameTypeAndSubTypeInWeaponKeys < ActiveRecord::Migration[6.1]
def change
rename_column :weapon_keys, :type, :slot
rename_column :weapon_keys, :subtype, :group
end
end

View file

@ -1,5 +0,0 @@
class AddOrderToWeaponKeys < ActiveRecord::Migration[6.1]
def change
add_column :weapon_keys, :order, :integer
end
end

View file

@ -1,7 +0,0 @@
class AddFieldsToUser < ActiveRecord::Migration[6.1]
def change
add_column :users, :picture, :string
add_column :users, :language, :string
add_column :users, :private, :boolean
end
end

View file

@ -1,7 +0,0 @@
class AddDefaultValuesToUser < ActiveRecord::Migration[6.1]
def change
change_column :users, :picture, :string, :default => "gran"
change_column :users, :language, :string, :default => "en"
change_column :users, :private, :boolean, :default => false
end
end

View file

@ -1,6 +0,0 @@
class AddNotNullableToUser < ActiveRecord::Migration[6.1]
def change
change_column :users, :language, :string, :default => "en", :null => false
change_column :users, :private, :boolean, :default => false, :null => false
end
end

View file

@ -1,5 +0,0 @@
class AddElementToUser < ActiveRecord::Migration[6.1]
def change
add_column :users, :element, :string, :default => "water", :null => false
end
end

View file

@ -1,5 +0,0 @@
class AddSlugToRaids < ActiveRecord::Migration[6.1]
def change
add_column :raids, :slug, :string
end
end

View file

@ -1,7 +0,0 @@
class AddGinIndexToWeapons < ActiveRecord::Migration[6.1]
def change
enable_extension "pg_trgm"
enable_extension "btree_gin"
add_index :weapons, :name_en, using: :gin, opclass: :gin_trgm_ops
end
end

View file

@ -1,6 +0,0 @@
class AddGinIndexToSummonsAndCharacters < ActiveRecord::Migration[6.1]
def change
add_index :summons, :name_en, using: :gin, opclass: :gin_trgm_ops
add_index :characters, :name_en, using: :gin, opclass: :gin_trgm_ops
end
end

View file

@ -1,5 +0,0 @@
class AddWeaponsCountToParties < ActiveRecord::Migration[6.1]
def change
add_column :parties, :weapons_count, :integer
end
end

View file

@ -1,7 +0,0 @@
class PopulatePartyWeaponsCount < ActiveRecord::Migration[6.1]
def up
Party.find_each do |party|
Party.reset_counters(party.id, :weapons)
end
end
end

View file

@ -1,14 +0,0 @@
class CreateClasses < ActiveRecord::Migration[6.0]
def change
create_table :classes, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :name_en
t.string :name_jp
t.integer :proficiency1
t.integer :proficiency2
t.string :row
t.boolean :ml, default: false
end
end
end

View file

@ -1,6 +0,0 @@
class AddClassAndMlToParty < ActiveRecord::Migration[6.1]
def change
add_reference :parties, :class, name: :class_id, type: :uuid, foreign_key: { to_table: :classes }
add_column :parties, :ml, :integer
end
end

View file

@ -1,6 +0,0 @@
class AddForeignKeyRelationsToParties < ActiveRecord::Migration[6.1]
def change
add_foreign_key :parties, :users
add_foreign_key :parties, :raids
end
end

View file

@ -1,6 +0,0 @@
class AddForeignKeyRelationsToFavorites < ActiveRecord::Migration[6.1]
def change
add_foreign_key :favorites, :users
add_foreign_key :favorites, :parties
end
end

View file

@ -1,12 +0,0 @@
class AddForeignKeyRelationsToObjects < ActiveRecord::Migration[6.1]
def change
add_foreign_key :grid_characters, :parties
add_foreign_key :grid_characters, :characters
add_foreign_key :grid_weapons, :parties
add_foreign_key :grid_weapons, :weapons
add_foreign_key :grid_summons, :parties
add_foreign_key :grid_summons, :summons
end
end

View file

@ -1,14 +0,0 @@
class AddDefaultPerpetuityToGridCharacters < ActiveRecord::Migration[6.1]
def up
GridCharacter.find_each do |char|
char.perpetuity = false
char.save!
end
change_column :grid_characters, :perpetuity, :boolean, default: false, null: false
end
def down
end
end

View file

@ -1,9 +0,0 @@
class AddDefaultsToCharacters < ActiveRecord::Migration[6.1]
def up
change_column :characters, :flb, :boolean, default: false, null: false
end
def down
end
end

View file

@ -1,24 +0,0 @@
class AddDefaultsToWeapons < ActiveRecord::Migration[6.1]
def up
Weapon.find_each do |w|
if w.flb.nil?
w.flb = false
w.save!
end
if w.ulb.nil?
w.ulb = false
w.save!
end
end
change_column :weapons, :flb, :boolean, default: false, null: false
change_column :weapons, :ulb, :boolean, default: false, null: false
change_column :weapons, :ax, :integer, default: 0, null: false
change_column :weapons, :series, :integer, default: -1, null: false
end
def down
end
end

View file

@ -1,24 +0,0 @@
class AddDefaultsToSummons < ActiveRecord::Migration[6.1]
def change
def up
Summon.find_each do |s|
if s.flb.nil?
s.flb = false
s.save!
end
if s.ulb.nil?
s.ulb = false
s.save!
end
end
change_column :summons, :flb, :boolean, default: false, null: false
change_column :summons, :ulb, :boolean, default: false, null: false
end
def down
end
end
end

View file

@ -1,5 +0,0 @@
class ChangeClassesToJobs < ActiveRecord::Migration[6.1]
def change
rename_table :classes, :jobs
end
end

View file

@ -1,5 +0,0 @@
class RenameClassIdToJobId < ActiveRecord::Migration[6.1]
def change
rename_column :parties, :class_id, :job_id
end
end

View file

@ -1,5 +0,0 @@
class AddOrderToJobs < ActiveRecord::Migration[6.1]
def change
add_column :jobs, :order, :integer
end
end

View file

@ -1,5 +0,0 @@
class AddGenderToUser < ActiveRecord::Migration[6.1]
def change
add_column :users, :gender, :integer, null: false, default: 0
end
end

View file

@ -1,5 +0,0 @@
class AddCharacterIdToCharacters < ActiveRecord::Migration[6.1]
def change
add_column :characters, :character_id, :integer, array: true, null: false, default: []
end
end

View file

@ -1,14 +0,0 @@
class AddJobSkillsTable < ActiveRecord::Migration[6.1]
def change
create_table :job_skills, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :job, type: :uuid
t.string :name_en, null: false, unique: true
t.string :name_jp, null: false, unique: true
t.string :slug, null: false, unique: true
t.integer :color, null: false
t.boolean :main, default: false
t.boolean :sub, default: false
t.boolean :emp, default: false
end
end
end

View file

@ -1,6 +0,0 @@
class RemoveNullConstraintFromJobSkills < ActiveRecord::Migration[6.1]
def change
change_column :job_skills, :name_en, :string, unique: false
change_column :job_skills, :name_jp, :string, unique: false
end
end

View file

@ -1,5 +0,0 @@
class AddOrderToJobSkills < ActiveRecord::Migration[6.1]
def change
add_column :job_skills, :order, :integer
end
end

View file

@ -1,6 +0,0 @@
class AddBaseAndGroupToJobSkills < ActiveRecord::Migration[6.1]
def change
add_column :job_skills, :base, :boolean, default: false
add_column :job_skills, :group, :integer
end
end

View file

@ -1,5 +0,0 @@
class RemoveGroupFromJobSkills < ActiveRecord::Migration[6.1]
def change
remove_column :job_skills, :group, :integer
end
end

View file

@ -1,9 +0,0 @@
class AddJobSkillsToParty < ActiveRecord::Migration[6.1]
def change
change_table(:parties) do |t|
t.references :skill1, type: :uuid, foreign_key: { to_table: 'job_skills' }
t.references :skill2, type: :uuid, foreign_key: { to_table: 'job_skills' }
t.references :skill3, type: :uuid, foreign_key: { to_table: 'job_skills' }
end
end
end

View file

@ -1,7 +0,0 @@
class AddSkill0ToParty < ActiveRecord::Migration[6.1]
def change
change_table(:parties) do |t|
t.references :skill0, type: :uuid, foreign_key: { to_table: "job_skills" }
end
end
end

View file

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

View file

@ -1,6 +0,0 @@
class AddAwakeningToGridWeapons < ActiveRecord::Migration[6.1]
def change
add_column :grid_weapons, :awakening_type, :integer, null: true
add_column :grid_weapons, :awakening_level, :integer, null: false, default: 1
end
end

View file

@ -1,6 +0,0 @@
class AddAwakeningToGridCharacters < ActiveRecord::Migration[6.1]
def change
add_column :grid_characters, :awakening_type, :integer, null: false, default: 0
add_column :grid_characters, :awakening_level, :integer, null: false, default: 1
end
end

View file

@ -1,5 +0,0 @@
class AddAwakeningToWeapons < ActiveRecord::Migration[6.1]
def change
add_column :weapons, :awakening, :boolean, null: false, default: true
end
end

View file

@ -1,5 +0,0 @@
class AddSlugToWeaponKeys < ActiveRecord::Migration[6.1]
def change
add_column :weapon_keys, :slug, :string
end
end

View file

@ -1,5 +0,0 @@
class AddThemeToUser < ActiveRecord::Migration[6.1]
def change
add_column :users, :theme, :string
end
end

View file

@ -1,5 +0,0 @@
class SetDefaultValueToTheme < ActiveRecord::Migration[6.1]
def change
change_column :users, :theme, :string, null: false, default: 'system'
end
end

View file

@ -1,6 +0,0 @@
class SetDefaultsOnWeapons < ActiveRecord::Migration[6.1]
def change
change_column :weapons, :max_level, :integer, null: false, default: 100
change_column :weapons, :max_skill_level, :integer, null: false, default: 10
end
end

View file

@ -1,6 +0,0 @@
class ChangeLimitToBoolean < ActiveRecord::Migration[6.1]
def change
add_column :weapons, :limit2, :boolean, default: false, null: false
add_column :summons, :limit2, :boolean, default: false, null: false
end
end

View file

@ -1,5 +0,0 @@
class RemoveLimitFromWeapons < ActiveRecord::Migration[6.1]
def change
remove_column :weapons, :limit, :integer
end
end

View file

@ -1,5 +0,0 @@
class RenameLimit2OnWeapon < ActiveRecord::Migration[6.1]
def change
rename_column :weapons, :limit2, :limit
end
end

View file

@ -1,5 +0,0 @@
class RemoveLimitFromSummons < ActiveRecord::Migration[6.1]
def change
remove_column :summons, :limit, :integer
end
end

Some files were not shown because too many files have changed in this diff Show more