20161017200007_create_articles.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. class CreateArticles < ActiveRecord::Migration
  2. def self.up
  3. create_table :articles do |t|
  4. t.string :title, :limit => 100, :null => false
  5. t.string :subtitle, :limit => 100
  6. t.text :about, :limit => 255
  7. t.text :content, :null => false
  8. t.text :url
  9. t.string :cover
  10. t.string :source, :limit => 100
  11. t.string :editor, :limit => 100
  12. t.integer :click, :default => 0
  13. t.integer :sort, :default => 0
  14. #推荐指数
  15. t.integer :recommend
  16. t.column :state, :boolean, :default => false
  17. #显示封面
  18. t.column :display_cover,:boolean, :default => false
  19. t.string :created_by, :limit => 100
  20. t.integer :article_cat_id, :null => false
  21. #赞成
  22. t.integer :agree, :default => 0
  23. #反对
  24. t.integer :disagree, :default => 0
  25. t.string :tags, :limit => 255
  26. #SEO关键字
  27. t.string :seo_title
  28. t.string :seo_keyword
  29. t.string :seo_desc
  30. #阅读原文指引
  31. t.column :url_guide, :text
  32. #分享点击指引
  33. t.column :share_benefit_desc, :string
  34. #文章是否显示客服二维码的开关
  35. t.column :show_cs_qrcode, :boolean, :default=>false
  36. #2018/1/9文章分享
  37. #分享标题
  38. t.column :s_title, :string
  39. #h5分享图片
  40. t.column :s_img, :string
  41. t.timestamps
  42. end
  43. add_index :articles, :article_cat_id
  44. add_index :articles, :title
  45. end
  46. def self.down
  47. drop_table :articles
  48. end
  49. end