feat: update database schema
Some checks are pending
Docker / docker (push) Waiting to run

- Add emoji_u column to countries table
- Add flag column to cities table
- Change default value of active column in cities table

This feature adds several new columns to the database schema, including an emoji_u column to the countries table and a flag column to the cities table. It also changes the default value of the active column in the cities table to false.
This commit is contained in:
songtianlun 2025-02-09 21:55:47 +08:00
parent 9df9f2cd91
commit edbfb32d65
2 changed files with 4 additions and 15 deletions

View File

@ -24,10 +24,12 @@ class MigrateWithCountriesStatesCitiesDatabase < ActiveRecord::Migration[8.0]
add_column :countries, :emoji_u, :string
add_column :countries, :flag, :boolean, default: true
add_column :countries, :wiki_data_id, :string
change_column_null :countries, :region_id, true
add_column :cities, :state_code, :string
add_column :cities, :country_code, :string
add_column :cities, :flag, :boolean, default: true
add_column :cities, :wiki_data_id, :string
change_column_default :cities, :active, false
end
end

17
db/schema.rb generated
View File

@ -111,6 +111,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.string "name"
t.float "latitude"
t.float "longitude"
t.boolean "active", default: false
t.integer "priority"
t.string "timezone"
t.datetime "created_at", null: false
@ -121,7 +122,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.string "country_code"
t.boolean "flag", default: true
t.string "wiki_data_id"
t.boolean "active", default: false
t.integer "state_id"
t.index ["country_id"], name: "index_cities_on_country_id"
t.index ["slug"], name: "index_cities_on_slug", unique: true
@ -132,9 +132,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.string "name"
t.string "code"
t.string "slug"
t.integer "region_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "emojiU"
t.string "iso3"
t.string "numeric_code"
t.string "iso2"
@ -145,7 +145,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.string "currency_symbol"
t.string "tld"
t.string "native"
t.string "region"
t.string "subregion"
t.string "nationality"
t.text "timezones"
@ -156,7 +155,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.string "emoji_u"
t.boolean "flag", default: true
t.string "wiki_data_id"
t.integer "region_id"
t.integer "subregion_id"
t.index ["code"], name: "index_countries_on_code", unique: true
t.index ["region_id"], name: "index_countries_on_region_id"
@ -218,17 +216,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_08_052634) do
t.index ["region_id"], name: "index_subregions_on_region_id"
end
create_table "votes", force: :cascade do |t|
t.string "votable_type"
t.integer "votable_id"
t.string "session_id"
t.integer "vote_type", default: 0
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["votable_id", "votable_type", "session_id", "vote_type"], name: "index_votes_on_votable_and_session_id_and_vote_type", unique: true
t.index ["votable_type", "votable_id"], name: "index_votes_on_votable"
end
create_table "weather_arts", force: :cascade do |t|
t.integer "city_id", null: false
t.date "weather_date"