class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.string :title, :limit => 100, :null => false t.string :subtitle, :limit => 100 t.text :about, :limit => 255 t.text :content, :null => false t.text :url t.string :cover t.string :source, :limit => 100 t.string :editor, :limit => 100 t.integer :click, :default => 0 t.integer :sort, :default => 0 #推荐指数 t.integer :recommend t.column :state, :boolean, :default => false #显示封面 t.column :display_cover,:boolean, :default => false t.string :created_by, :limit => 100 t.integer :article_cat_id, :null => false #赞成 t.integer :agree, :default => 0 #反对 t.integer :disagree, :default => 0 t.string :tags, :limit => 255 #SEO关键字 t.string :seo_title t.string :seo_keyword t.string :seo_desc #阅读原文指引 t.column :url_guide, :text #分享点击指引 t.column :share_benefit_desc, :string #文章是否显示客服二维码的开关 t.column :show_cs_qrcode, :boolean, :default=>false #2018/1/9文章分享 #分享标题 t.column :s_title, :string #h5分享图片 t.column :s_img, :string t.timestamps end add_index :articles, :article_cat_id add_index :articles, :title end def self.down drop_table :articles end end