20161017200009_create_ad_positions.rb 797 B

1234567891011121314151617181920212223242526272829303132
  1. # encoding: utf-8
  2. # 广告位置配置
  3. class CreateAdPositions < ActiveRecord::Migration
  4. def up
  5. create_table :ad_positions do |t|
  6. #广告位置标识符
  7. t.string :code, :null => false
  8. #广告位置名称
  9. t.string :name, :null => false
  10. #广告位置描述
  11. t.string :remark, :null => false
  12. #该广告位被点击的总次数
  13. t.integer :click_times, :default => 0,:comment => 0
  14. #广告位招租图片
  15. t.text :img, :null => false
  16. #图片点击链接
  17. t.text :click_url
  18. #是否使用
  19. t.boolean :state, :default => true
  20. t.timestamps
  21. end
  22. add_index :ad_positions, :code, :unique => true
  23. add_index :ad_positions, :click_times
  24. end
  25. def down
  26. drop_table :ad_positions
  27. end
  28. end