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