Class: CreateUsers

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

Class Method Summary collapse

Class Method Details

.downObject



42
43
44
# File 'lib/generators/templates/migration_create_user.rb', line 42

def self.down
  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
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/templates/migration_create_user.rb', line 2

def self.up
  if !table_exists? :users
    create_table :users do |t|
      t.string :provider
      t.string :uid
      t.string :email
      t.string :username
      t.boolean :verified
      t.boolean :admin
      t.string :referred_by
      t.string :token
      t.text :tags
      t.text :referred
      t.text :access_tokens
      t.boolean :subscribed
      t.string :display
      t.text :identities
      t.datetime :created

      t.timestamps
    end
  else
    safe_column :users, :provider, :string
    safe_column :users, :uid, :string
    safe_column :users, :email, :string
    safe_column :users, :username, :string
    safe_column :users, :verified, :boolean
    safe_column :users, :admin, :boolean
    safe_column :users, :referred, :string
    safe_column :users, :token, :string
    safe_column :users, :tags, :text
    safe_column :users, :referred, :text
    safe_column :users, :access_tokens, :text
    safe_column :users, :display, :string
    safe_column :users, :subscribed, :boolean
    safe_column :users, :identities, :text
    safe_column :users, :created, :datetime
  end
end