lib/generators/china_regions/templates/migration.rb in china_regions-0.4.5 vs lib/generators/china_regions/templates/migration.rb in china_regions-1.0.0
- old
+ new
@@ -8,10 +8,11 @@
end
def setup_provinces
create_table :provinces do |t|
t.string :name
+ t.integer :code
t.string :name_en
t.string :name_abbr
t.timestamps
end
@@ -20,29 +21,33 @@
end
def setup_citites
create_table :cities do |t|
t.string :name
+ t.integer :code
t.integer :province_id
t.integer :level
- t.string :zip_code
t.string :name_en
t.string :name_abbr
t.timestamps
end
add_index :cities, :name
+ add_index :cities, :province_id
end
def setup_districts
create_table :districts do |t|
t.string :name
t.integer :city_id
+ t.integer :code
t.string :name_en
t.string :name_abbr
t.timestamps
end
+
add_index :districts, :name
+ add_index :districts, :city_id
end
end