Update database with new columns
This commit is contained in:
parent
583eba428a
commit
d45758acd7
5 changed files with 39 additions and 2 deletions
14
db/data/20230716132721_populate_wiki_en_column.rb
Normal file
14
db/data/20230716132721_populate_wiki_en_column.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PopulateWikiEnColumn < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
Character.all.each do |c|
|
||||
c.wiki_en = c.name_en
|
||||
c.save
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +1 @@
|
|||
DataMigrate::Data.define(version: 20230702035600)
|
||||
DataMigrate::Data.define(version: 20230716132721)
|
||||
|
|
|
|||
5
db/migrate/20230716132629_add_gbf_wiki_to_character.rb
Normal file
5
db/migrate/20230716132629_add_gbf_wiki_to_character.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddGbfWikiToCharacter < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :characters, :wiki_en, :string, null: false, default: ''
|
||||
end
|
||||
end
|
||||
11
db/migrate/20230717011150_add_columns_to_characters.rb
Normal file
11
db/migrate/20230717011150_add_columns_to_characters.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddColumnsToCharacters < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :characters, :release_date, :date
|
||||
add_column :characters, :flb_date, :date
|
||||
add_column :characters, :ulb_date, :date
|
||||
|
||||
add_column :characters, :wiki_ja, :string, null: false, default: ''
|
||||
add_column :characters, :gamewith, :string, null: false, default: ''
|
||||
add_column :characters, :kamigame, :string, null: false, default: ''
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_05_065015) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_17_011150) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gin"
|
||||
enable_extension "pg_trgm"
|
||||
|
|
@ -103,6 +103,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_05_065015) do
|
|||
t.integer "character_id", default: [], null: false, array: true
|
||||
t.string "nicknames_en", default: [], null: false, array: true
|
||||
t.string "nicknames_jp", default: [], null: false, array: true
|
||||
t.string "wiki_en", default: "", null: false
|
||||
t.date "release_date"
|
||||
t.date "flb_date"
|
||||
t.date "ulb_date"
|
||||
t.string "wiki_ja", default: "", null: false
|
||||
t.string "gamewith", default: "", null: false
|
||||
t.string "kamigame", default: "", null: false
|
||||
t.index ["name_en"], name: "index_characters_on_name_en", opclass: :gin_trgm_ops, using: :gin
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue