class CreateWxEvents < ActiveRecord::Migration def self.up create_table :wx_events do |t| #微信公众号 t.integer :wx_gongzhonghao_id, :null => false # 回复类型,图文,文本 t.column :return_type, "ENUM('item', 'text') NOT NULL" # 发送的关键字 t.string :key # 回复图文时的图文列表rootId t.integer :wx_event_item_id t.text :return_text_content t.column :state, :boolean, :default => false t.timestamps end add_index :wx_events, :wx_gongzhonghao_id add_index :wx_events, :key create_table :wx_event_items do |t| #微信公众号 t.integer :article_id, :null => false #树状名称 t.column :name, :string, :null => false, :limit => 100 #新标题,否则就用article的title t.column :title, :string #是否启用新标题 t.column :use_title, :boolean, :default => false #新封面,否则就用article的封面 t.column :cover, :string #是否启用新封面 t.column :use_cover, :boolean, :default => false #新点击链接,否则就是article的详情页 t.column :href, :string #是否启用新链接 t.column :use_href, :boolean, :default => false t.column :position, :integer t.column :click_times, :integer t.column :ancestry, :string, :limit => 100 #是否启用 t.column :state, :boolean, :default => false end add_index :wx_event_items, :ancestry end def self.down drop_table :wx_events drop_table :wx_event_items end end