20161017200010_create_ad_items.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # encoding: utf-8
  2. # 广告位图片
  3. class CreateAdItems < ActiveRecord::Migration
  4. def up
  5. create_table :ad_items do |t|
  6. #所属广告位
  7. t.integer :ad_position_id, :null => false
  8. #图片名称
  9. t.string :name, :null => false
  10. #图片地址
  11. t.text :img, :null => false
  12. #图片点击链接
  13. t.text :click_url
  14. #2018/1/6 QiaoLing.Z Add
  15. t.column :url, :string, :limit => 4096, :default => ''
  16. #内部链接:0,外部链接:1
  17. t.tinyint :url_type, :default => 0
  18. #2018/1/6 QiaoLing.Z Add
  19. #该广告图片被点击的次数
  20. t.integer :click_times, :default => 0
  21. #该广告图片被展示的次数
  22. t.integer :show_times, :default => 0
  23. #有效期
  24. t.column :expired_at, :datetime
  25. #是否使用
  26. t.boolean :state, :default => true
  27. #排序
  28. t.integer :sort, :default => 0
  29. t.timestamps
  30. end
  31. add_index :ad_items, :ad_position_id
  32. add_index :ad_items, :sort
  33. end
  34. def down
  35. drop_table :ad_items
  36. end
  37. end