Class: CreateTweetsTable

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

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/twisplay/templates/migration.rb', line 17

def self.down
  drop_table :tweets
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/twisplay/templates/migration.rb', line 2

def self.up
  create_table :tweets do |t|
    t.text     :text
    t.datetime :tweet_created_at
    t.string   :tweet_id
    t.string   :user_name
    t.string   :user_screen_name
    t.string   :user_profile_image_url
    t.timestamps
  end
  
  add_index :tweets, :tweet_created_at
  add_index :tweets, :tweet_id, :unique => true
end