today_ai_weather/db/migrate/20250208052549_create_states.rb

23 lines
583 B
Ruby

class CreateStates < ActiveRecord::Migration[8.0]
def change
create_table :states do |t|
t.string :name
t.string :code
t.references :country, foreign_key: true
t.string :country_code
t.string :fips_code
t.string :iso2
t.string :state_type
t.integer :level
t.integer :parent_id
t.decimal :latitude, precision: 10, scale: 8
t.decimal :longitude, precision: 11, scale: 8
t.boolean :flag
t.string :wiki_data_id
t.timestamps
end
add_reference :cities, :state, foreign_key: true
end
end