Module: Helpers::Migrations::Tables::InstanceMethods

Defined in:
lib/helpers/migrations.rb

Instance Method Summary collapse

Instance Method Details

#authentasaurus_areaObject

creates areas table



49
50
51
52
53
54
55
# File 'lib/helpers/migrations.rb', line 49

def authentasaurus_area
  create_table :areas do |t|
    t.string :name, :null => false
    
    t.timestamps
  end
end

#authentasaurus_drop_areaObject

drops areas table



124
125
126
# File 'lib/helpers/migrations.rb', line 124

def authentasaurus_drop_area
  drop_table :areas
end

#authentasaurus_drop_groupObject

drops groups table



119
120
121
# File 'lib/helpers/migrations.rb', line 119

def authentasaurus_drop_group
  drop_table :groups
end

#authentasaurus_drop_permissionObject

drops permissions table



129
130
131
# File 'lib/helpers/migrations.rb', line 129

def authentasaurus_drop_permission
  drop_table :permissions
end

#authentasaurus_drop_recoveryObject

drops recoveries table



144
145
146
# File 'lib/helpers/migrations.rb', line 144

def authentasaurus_drop_recovery
  drop_table :recoveries
end

#authentasaurus_drop_tablesObject

drops all tables



103
104
105
106
107
108
109
110
111
# File 'lib/helpers/migrations.rb', line 103

def authentasaurus_drop_tables
  authentasaurus_drop_user
  authentasaurus_drop_group
  authentasaurus_drop_area
  authentasaurus_drop_permission
  authentasaurus_drop_validation
  authentasaurus_drop_user_invitation
  authentasaurus_drop_recovery
end

#authentasaurus_drop_userObject

drops users table



114
115
116
# File 'lib/helpers/migrations.rb', line 114

def authentasaurus_drop_user
  drop_table :users
end

#authentasaurus_drop_user_invitationObject

drops user_invitations table



139
140
141
# File 'lib/helpers/migrations.rb', line 139

def authentasaurus_drop_user_invitation
  drop_table :user_invitations
end

#authentasaurus_drop_validationObject

drops validations table



134
135
136
# File 'lib/helpers/migrations.rb', line 134

def authentasaurus_drop_validation
  drop_table :validations
end

#authentasaurus_groupObject

creates groups table



40
41
42
43
44
45
46
# File 'lib/helpers/migrations.rb', line 40

def authentasaurus_group
  create_table :groups do |t|
    t.string :name, :null => false
    
    t.timestamps
  end
end

#authentasaurus_permissionObject

creates permissions table



58
59
60
61
62
63
64
65
66
67
# File 'lib/helpers/migrations.rb', line 58

def authentasaurus_permission
  create_table :permissions do |t|
    t.integer :group_id, :null => false
    t.integer :area_id, :null => false
    t.boolean :read, :null => false, :default => false
    t.boolean :write, :null => false, :default => false
    
    t.timestamps
  end
end

#authentasaurus_recoveryObject

creates recoveries table



92
93
94
95
96
97
98
99
100
# File 'lib/helpers/migrations.rb', line 92

def authentasaurus_recovery
  create_table :recoveries do |t|
    t.integer :user_id, :null => false
    t.string  :email, :null => false
    t.string :token, :null => false, :unique => true
		
    t.timestamps
  end
end

#authentasaurus_tablesObject

creates all tables



10
11
12
13
14
15
16
17
18
# File 'lib/helpers/migrations.rb', line 10

def authentasaurus_tables
  authentasaurus_user :authorizable
  authentasaurus_group
  authentasaurus_area
  authentasaurus_permission
  authentasaurus_validation
  authentasaurus_user_invitation
  authentasaurus_recovery
end

#authentasaurus_user(*opts) ⇒ Object

creates users table



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/helpers/migrations.rb', line 21

def authentasaurus_user(*opts)
  create_table :users do |t|
    t.string :username, :null => false
    t.string :hashed_password, :null => false
    t.string :password_seed, :null => false
    t.string :name, :null => false
    t.string :email, :null => false
    t.boolean :active, :null => false, :default => false
    t.string :remember_me_token
    
    if opts.include?(:authorizable) || opts.include?("authorizable")
      t.integer :group_id, :null => false
    end
    
    t.timestamps
  end
end

#authentasaurus_user_invitationObject

creates user_invitations table



82
83
84
85
86
87
88
89
# File 'lib/helpers/migrations.rb', line 82

def authentasaurus_user_invitation
  create_table :user_invitations do |t|
    t.string  :token, :null => false, :unique => true
    t.string  :email
    
    t.timestamps
  end
end

#authentasaurus_validationObject

creates validations table



70
71
72
73
74
75
76
77
78
79
# File 'lib/helpers/migrations.rb', line 70

def authentasaurus_validation
  create_table :validations do |t|
    t.integer :user_id, :null => false
    t.string  :user_type, :null => false
    t.string :email, :null => false
    t.string :validation_code, :null => false
    
    t.timestamps
  end
end