class CreateEducodeSalesRoles < ActiveRecord::Migration[5.2] def change create_table :educode_sales_roles do |t| t.string :name t.timestamps end add_column :educode_sales_staffs, :role_id, :integer add_column :educode_sales_staffs, :expired_at, :datetime add_column :educode_sales_staffs, :enabled_at, :datetime add_column :educode_sales_staffs, :job_type, :integer if EducodeSales::Common.first.nil? citys = ["北京", "上海", "广东", "江苏", "浙江", "重庆", "安徽", "福建", "甘肃", "广西", "贵州", "海南", "河北", "黑龙江", "河南", "湖北", "湖南", "江西", "吉林", "辽宁", "内蒙古", "宁夏", "青海", "山东", "山西", "陕西", "四川", "天津", "新疆", "西藏", "云南", "香港特别行政区", "澳门特别行政区", "台湾"] citys.each do |city| EducodeSales::Common.create(clazz: '区域', name: city) end end end end