Class: CreatePosts

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/create_posts.rb

Class Method Summary collapse

Class Method Details

.downObject



33
34
35
# File 'lib/generators/templates/create_posts.rb', line 33

def self.down
  drop_table :posts
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/templates/create_posts.rb', line 2

def self.up
  create_table :posts, :force => true do |t|
    t.string :post_type
    t.string :title
    t.text :body
    t.string :slug
    t.datetime :published_at
    t.string :state
    t.timestamps
    t.integer :tumblr_id, :limit => 8 # BigInt because new tumblr ids are longer
    t.integer :likes_count, :default => 0
    t.integer :votes_count, :default => 0
    t.integer :twitter_id
    t.integer :facebook_id
    t.string :display_type
    t.integer :tw_delayed_job_id
    t.integer :fb_delayed_job_id
    t.integer :tumblr_delayed_job_id
    t.string :social_msg, :limit => 140
    t.integer :linkable_id
    t.string :linkable_type
    t.string :import_url
  end
  add_index :posts, :slug
  add_index :posts, :likes_count
  add_index :posts, :votes_count
  add_index :posts, :twitter_id
  add_index :posts, :linkable_id
  add_index :posts, :tumblr_delayed_job_id
end