# encoding: utf-8 # 广告位图片 class CreateAdItems < ActiveRecord::Migration def up create_table :ad_items do |t| #所属广告位 t.integer :ad_position_id, :null => false #图片名称 t.string :name, :null => false #图片地址 t.text :img, :null => false #图片点击链接 t.text :click_url #2018/1/6 QiaoLing.Z Add t.column :url, :string, :limit => 4096, :default => '' #内部链接:0,外部链接:1 t.tinyint :url_type, :default => 0 #2018/1/6 QiaoLing.Z Add #该广告图片被点击的次数 t.integer :click_times, :default => 0 #该广告图片被展示的次数 t.integer :show_times, :default => 0 #有效期 t.column :expired_at, :datetime #是否使用 t.boolean :state, :default => true #排序 t.integer :sort, :default => 0 t.timestamps end add_index :ad_items, :ad_position_id add_index :ad_items, :sort end def down drop_table :ad_items end end