Class: CreateOmnisocialTables

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

Class Method Summary collapse

Class Method Details

.downObject



29
30
31
32
33
34
# File 'lib/generators/omnisocial/templates/migration.rb', line 29

def self.down
  remove_index :login_accounts, :type
  remove_index :login_accounts, :user_id
  drop_table :login_accounts
  drop_table :users
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
# File 'lib/generators/omnisocial/templates/migration.rb', line 2

def self.up
  create_table :users do |t|
    t.string :remember_token
    # Any additional fields here
    t.string :display_name
    t.string :email_address
    t.string :picture_url
    
    t.timestamps
  end
  
  create_table :login_accounts do |t|
    t.string :type
    t.string :user_id
    t.string :remote_account_id
    t.string :name
    t.string :login
    t.string :picture_url
    # Any additional fields here 
    
    t.timestamps
  end
  
  add_index :login_accounts, :user_id
  add_index :login_accounts, :type
end