# encoding:utf-8 class CreateGroupMessages < ActiveRecord::Migration def up #群发短信 create_table :group_messages do |t| # 部门 t.column :depart_record_id, :integer, :limit => 4, :default => 0 # 模版码 t.column :code, :string, :limit => 64,unique: true # 模版名称 t.column :name, :string, :limit => 128, :default => 0 # 内容一 t.column :keyword1, :string, :limit => 128 # 内容二 t.column :keyword2, :string, :limit => 128 # 内容三 t.column :keyword3, :string, :limit => 128 # 发送总数 t.column :count, :integer, :limit => 11 # 描述 t.column :remark, :string, :limit => 128 t.timestamps end add_index :group_messages,:code,:name => "idx_code" #群发短信记录 create_table :group_message_records do |t| # 微信ID t.column :wx_user_id, :integer, :limit => 4, :default => 0 # 手机号码 t.column :mobile, :string, :limit => 64,unique: true # 群发ID t.column :group_message_id, :string, :limit => 128, :default => 0 t.timestamps end add_index :group_message_records,:mobile,:name => "idx_mobile" end def down drop_table :group_messages drop_table :group_message_records end end