From edbfb32d65efaec0a4b4b3904ca152c3ab8300f3 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sun, 9 Feb 2025 21:55:47 +0800 Subject: [PATCH] feat: update database schema - 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. --- ...ate_with_countries_states_cities_database.rb | 2 ++ db/schema.rb | 17 ++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/db/migrate/20250208052451_migrate_with_countries_states_cities_database.rb b/db/migrate/20250208052451_migrate_with_countries_states_cities_database.rb index 8487be0..1f33b3d 100644 --- a/db/migrate/20250208052451_migrate_with_countries_states_cities_database.rb +++ b/db/migrate/20250208052451_migrate_with_countries_states_cities_database.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 373911c..9ce0fbd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"