20201124114698_create_bind_users.rb 862 B

123456789101112131415161718192021222324252627282930313233343536
  1. # encoding:utf-8
  2. class CreateBindUsers < ActiveRecord::Migration
  3. def up
  4. #用户绑定记录
  5. create_table :bind_users do |t|
  6. #用户ID
  7. t.column :wx_uid, :integer, :null=>false
  8. #老用户编号
  9. t.column :user_no, :string
  10. #备注
  11. t.column :remark,:string
  12. t.timestamps
  13. end
  14. #系统会员表
  15. create_table :sys_users do |t|
  16. #邀请人ID
  17. t.column :invite_id, :integer, :null=>false
  18. #会员编号
  19. t.column :user_no, :string, :limit=>128
  20. #邀请人编号
  21. t.column :invite_no,:string, :limit=>128
  22. t.timestamps
  23. end
  24. add_index :bind_users, :wx_uid
  25. add_index :sys_users, :invite_id
  26. add_column :wx_users, :user_no,:string,:limit => 128
  27. end
  28. def down
  29. drop_table :bind_users
  30. drop_table :sys_users
  31. remove_column :wx_users, :user_no
  32. end
  33. end