20210815114628_create_group_messages.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # encoding:utf-8
  2. class CreateGroupMessages < ActiveRecord::Migration
  3. def up
  4. #群发短信
  5. create_table :group_messages do |t|
  6. # 部门
  7. t.column :depart_record_id, :integer, :limit => 4, :default => 0
  8. # 模版码
  9. t.column :code, :string, :limit => 64,unique: true
  10. # 模版名称
  11. t.column :name, :string, :limit => 128, :default => 0
  12. # 内容一
  13. t.column :keyword1, :string, :limit => 128
  14. # 内容二
  15. t.column :keyword2, :string, :limit => 128
  16. # 内容三
  17. t.column :keyword3, :string, :limit => 128
  18. # 发送总数
  19. t.column :count, :integer, :limit => 11
  20. # 描述
  21. t.column :remark, :string, :limit => 128
  22. t.timestamps
  23. end
  24. add_index :group_messages,:code,:name => "idx_code"
  25. #群发短信记录
  26. create_table :group_message_records do |t|
  27. # 微信ID
  28. t.column :wx_user_id, :integer, :limit => 4, :default => 0
  29. # 手机号码
  30. t.column :mobile, :string, :limit => 64,unique: true
  31. # 群发ID
  32. t.column :group_message_id, :string, :limit => 128, :default => 0
  33. t.timestamps
  34. end
  35. add_index :group_message_records,:mobile,:name => "idx_mobile"
  36. end
  37. def down
  38. drop_table :group_messages
  39. drop_table :group_message_records
  40. end
  41. end