digix_devise_token_auth 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +13 -0
  3. data/README.md +952 -0
  4. data/Rakefile +35 -0
  5. data/app/controllers/devise_token_auth/application_controller.rb +76 -0
  6. data/app/controllers/devise_token_auth/concerns/resource_finder.rb +43 -0
  7. data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +165 -0
  8. data/app/controllers/devise_token_auth/confirmations_controller.rb +30 -0
  9. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +243 -0
  10. data/app/controllers/devise_token_auth/passwords_controller.rb +202 -0
  11. data/app/controllers/devise_token_auth/registrations_controller.rb +205 -0
  12. data/app/controllers/devise_token_auth/sessions_controller.rb +133 -0
  13. data/app/controllers/devise_token_auth/token_validations_controller.rb +29 -0
  14. data/app/controllers/devise_token_auth/unlocks_controller.rb +89 -0
  15. data/app/models/devise_token_auth/concerns/user.rb +260 -0
  16. data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +26 -0
  17. data/app/validators/email_validator.rb +21 -0
  18. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  19. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  20. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  21. data/app/views/devise_token_auth/omniauth_external_window.html.erb +38 -0
  22. data/config/initializers/devise.rb +196 -0
  23. data/config/locales/da-DK.yml +50 -0
  24. data/config/locales/de.yml +49 -0
  25. data/config/locales/en.yml +50 -0
  26. data/config/locales/es.yml +49 -0
  27. data/config/locales/fr.yml +49 -0
  28. data/config/locales/it.yml +46 -0
  29. data/config/locales/ja.yml +46 -0
  30. data/config/locales/nl.yml +30 -0
  31. data/config/locales/pl.yml +48 -0
  32. data/config/locales/pt-BR.yml +46 -0
  33. data/config/locales/pt.yml +48 -0
  34. data/config/locales/ro.yml +46 -0
  35. data/config/locales/ru.yml +50 -0
  36. data/config/locales/sq.yml +46 -0
  37. data/config/locales/uk.yml +59 -0
  38. data/config/locales/vi.yml +50 -0
  39. data/config/locales/zh-CN.yml +46 -0
  40. data/config/locales/zh-HK.yml +48 -0
  41. data/config/locales/zh-TW.yml +48 -0
  42. data/lib/devise_token_auth.rb +8 -0
  43. data/lib/devise_token_auth/controllers/helpers.rb +149 -0
  44. data/lib/devise_token_auth/controllers/url_helpers.rb +8 -0
  45. data/lib/devise_token_auth/engine.rb +90 -0
  46. data/lib/devise_token_auth/rails/routes.rb +114 -0
  47. data/lib/devise_token_auth/url.rb +37 -0
  48. data/lib/devise_token_auth/version.rb +3 -0
  49. data/lib/generators/devise_token_auth/USAGE +31 -0
  50. data/lib/generators/devise_token_auth/install_generator.rb +160 -0
  51. data/lib/generators/devise_token_auth/install_views_generator.rb +16 -0
  52. data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +48 -0
  53. data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +55 -0
  54. data/lib/generators/devise_token_auth/templates/user.rb +7 -0
  55. data/lib/tasks/devise_token_auth_tasks.rake +4 -0
  56. data/test/controllers/custom/custom_confirmations_controller_test.rb +21 -0
  57. data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +29 -0
  58. data/test/controllers/custom/custom_passwords_controller_test.rb +75 -0
  59. data/test/controllers/custom/custom_registrations_controller_test.rb +54 -0
  60. data/test/controllers/custom/custom_sessions_controller_test.rb +37 -0
  61. data/test/controllers/custom/custom_token_validations_controller_test.rb +40 -0
  62. data/test/controllers/demo_group_controller_test.rb +153 -0
  63. data/test/controllers/demo_mang_controller_test.rb +284 -0
  64. data/test/controllers/demo_user_controller_test.rb +601 -0
  65. data/test/controllers/devise_token_auth/confirmations_controller_test.rb +129 -0
  66. data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +371 -0
  67. data/test/controllers/devise_token_auth/passwords_controller_test.rb +649 -0
  68. data/test/controllers/devise_token_auth/registrations_controller_test.rb +878 -0
  69. data/test/controllers/devise_token_auth/sessions_controller_test.rb +500 -0
  70. data/test/controllers/devise_token_auth/token_validations_controller_test.rb +90 -0
  71. data/test/controllers/devise_token_auth/unlocks_controller_test.rb +194 -0
  72. data/test/controllers/overrides/confirmations_controller_test.rb +43 -0
  73. data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +49 -0
  74. data/test/controllers/overrides/passwords_controller_test.rb +66 -0
  75. data/test/controllers/overrides/registrations_controller_test.rb +40 -0
  76. data/test/controllers/overrides/sessions_controller_test.rb +33 -0
  77. data/test/controllers/overrides/token_validations_controller_test.rb +41 -0
  78. data/test/dummy/README.rdoc +28 -0
  79. data/test/dummy/app/controllers/application_controller.rb +16 -0
  80. data/test/dummy/app/controllers/auth_origin_controller.rb +5 -0
  81. data/test/dummy/app/controllers/custom/confirmations_controller.rb +13 -0
  82. data/test/dummy/app/controllers/custom/omniauth_callbacks_controller.rb +11 -0
  83. data/test/dummy/app/controllers/custom/passwords_controller.rb +40 -0
  84. data/test/dummy/app/controllers/custom/registrations_controller.rb +39 -0
  85. data/test/dummy/app/controllers/custom/sessions_controller.rb +29 -0
  86. data/test/dummy/app/controllers/custom/token_validations_controller.rb +19 -0
  87. data/test/dummy/app/controllers/demo_group_controller.rb +13 -0
  88. data/test/dummy/app/controllers/demo_mang_controller.rb +12 -0
  89. data/test/dummy/app/controllers/demo_user_controller.rb +25 -0
  90. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +26 -0
  91. data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +14 -0
  92. data/test/dummy/app/controllers/overrides/passwords_controller.rb +33 -0
  93. data/test/dummy/app/controllers/overrides/registrations_controller.rb +27 -0
  94. data/test/dummy/app/controllers/overrides/sessions_controller.rb +36 -0
  95. data/test/dummy/app/controllers/overrides/token_validations_controller.rb +23 -0
  96. data/test/dummy/app/helpers/application_helper.rb +1065 -0
  97. data/test/dummy/app/models/evil_user.rb +3 -0
  98. data/test/dummy/app/models/lockable_user.rb +5 -0
  99. data/test/dummy/app/models/mang.rb +3 -0
  100. data/test/dummy/app/models/nice_user.rb +7 -0
  101. data/test/dummy/app/models/only_email_user.rb +5 -0
  102. data/test/dummy/app/models/scoped_user.rb +7 -0
  103. data/test/dummy/app/models/unconfirmable_user.rb +8 -0
  104. data/test/dummy/app/models/unregisterable_user.rb +7 -0
  105. data/test/dummy/app/models/user.rb +18 -0
  106. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  107. data/test/dummy/config.ru +16 -0
  108. data/test/dummy/config/application.rb +24 -0
  109. data/test/dummy/config/application.yml.bk +0 -0
  110. data/test/dummy/config/boot.rb +5 -0
  111. data/test/dummy/config/environment.rb +5 -0
  112. data/test/dummy/config/environments/development.rb +44 -0
  113. data/test/dummy/config/environments/production.rb +82 -0
  114. data/test/dummy/config/environments/test.rb +48 -0
  115. data/test/dummy/config/initializers/assets.rb +8 -0
  116. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  117. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  118. data/test/dummy/config/initializers/devise.rb +3 -0
  119. data/test/dummy/config/initializers/devise_token_auth.rb +22 -0
  120. data/test/dummy/config/initializers/figaro.rb +1 -0
  121. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  122. data/test/dummy/config/initializers/inflections.rb +16 -0
  123. data/test/dummy/config/initializers/mime_types.rb +4 -0
  124. data/test/dummy/config/initializers/omniauth.rb +8 -0
  125. data/test/dummy/config/initializers/session_store.rb +3 -0
  126. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  127. data/test/dummy/config/routes.rb +72 -0
  128. data/test/dummy/config/spring.rb +1 -0
  129. data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +63 -0
  130. data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +62 -0
  131. data/test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb +6 -0
  132. data/test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb +5 -0
  133. data/test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb +64 -0
  134. data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +60 -0
  135. data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +61 -0
  136. data/test/dummy/db/migrate/20150409095712_devise_token_auth_create_nice_users.rb +61 -0
  137. data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +61 -0
  138. data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +61 -0
  139. data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +61 -0
  140. data/test/dummy/db/schema.rb +258 -0
  141. data/test/dummy/lib/migration_database_helper.rb +29 -0
  142. data/test/integration/navigation_test.rb +10 -0
  143. data/test/lib/devise_token_auth/url_test.rb +24 -0
  144. data/test/lib/generators/devise_token_auth/install_generator_test.rb +187 -0
  145. data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +23 -0
  146. data/test/models/only_email_user_test.rb +35 -0
  147. data/test/models/user_test.rb +169 -0
  148. data/test/test_helper.rb +77 -0
  149. metadata +342 -0
@@ -0,0 +1,61 @@
1
+ include MigrationDatabaseHelper
2
+
3
+ class DeviseTokenAuthCreateUnconfirmableUsers < ActiveRecord::Migration[4.2]
4
+ def change
5
+ create_table(:unconfirmable_users) do |t|
6
+ ## Required
7
+ t.string :provider, :null => false
8
+ t.string :uid, :null => false, :default => ""
9
+
10
+ ## Database authenticatable
11
+ t.string :encrypted_password, :null => false, :default => ""
12
+
13
+ ## Recoverable
14
+ t.string :reset_password_token
15
+ t.datetime :reset_password_sent_at
16
+ t.boolean :allow_password_change, :default => false
17
+
18
+ ## Rememberable
19
+ t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ t.integer :sign_in_count, :default => 0, :null => false
23
+ t.datetime :current_sign_in_at
24
+ t.datetime :last_sign_in_at
25
+ t.string :current_sign_in_ip
26
+ t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ # t.string :confirmation_token
30
+ # t.datetime :confirmed_at
31
+ # t.datetime :confirmation_sent_at
32
+ # t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
36
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ # t.datetime :locked_at
38
+
39
+ ## User Info
40
+ t.string :name
41
+ t.string :nickname
42
+ t.string :image
43
+ t.string :email
44
+
45
+ ## Tokens
46
+ if json_supported_database?
47
+ t.json :tokens
48
+ else
49
+ t.text :tokens
50
+ end
51
+
52
+ t.timestamps
53
+ end
54
+
55
+ add_index :unconfirmable_users, :email
56
+ add_index :unconfirmable_users, [:uid, :provider], :unique => true
57
+ add_index :unconfirmable_users, :reset_password_token, :unique => true
58
+ # add_index :nice_users, :confirmation_token, :unique => true
59
+ # add_index :nice_users, :unlock_token, :unique => true
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ include MigrationDatabaseHelper
2
+
3
+ class DeviseTokenAuthCreateScopedUsers < ActiveRecord::Migration[4.2]
4
+ def change
5
+ create_table(:scoped_users) do |t|
6
+ ## Required
7
+ t.string :provider, :null => false
8
+ t.string :uid, :null => false, :default => ""
9
+
10
+ ## Database authenticatable
11
+ t.string :encrypted_password, :null => false, :default => ""
12
+
13
+ ## Recoverable
14
+ t.string :reset_password_token
15
+ t.datetime :reset_password_sent_at
16
+ t.boolean :allow_password_change, :default => false
17
+
18
+ ## Rememberable
19
+ t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ t.integer :sign_in_count, :default => 0, :null => false
23
+ t.datetime :current_sign_in_at
24
+ t.datetime :last_sign_in_at
25
+ t.string :current_sign_in_ip
26
+ t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ t.string :confirmation_token
30
+ t.datetime :confirmed_at
31
+ t.datetime :confirmation_sent_at
32
+ t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
36
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ # t.datetime :locked_at
38
+
39
+ ## User Info
40
+ t.string :name
41
+ t.string :nickname
42
+ t.string :image
43
+ t.string :email
44
+
45
+ ## Tokens
46
+ if json_supported_database?
47
+ t.json :tokens
48
+ else
49
+ t.text :tokens
50
+ end
51
+
52
+ t.timestamps
53
+ end
54
+
55
+ add_index :scoped_users, :email
56
+ add_index :scoped_users, [:uid, :provider], :unique => true
57
+ add_index :scoped_users, :reset_password_token, :unique => true
58
+ # add_index :scoped_users, :confirmation_token, :unique => true
59
+ # add_index :scoped_users, :unlock_token, :unique => true
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ include MigrationDatabaseHelper
2
+
3
+ class DeviseTokenAuthCreateLockableUsers < ActiveRecord::Migration[4.2]
4
+ def change
5
+ create_table(:lockable_users) do |t|
6
+ ## Required
7
+ t.string :provider, :null => false
8
+ t.string :uid, :null => false, :default => ""
9
+
10
+ ## Database authenticatable
11
+ t.string :encrypted_password, :null => false, :default => ""
12
+
13
+ ## Recoverable
14
+ # t.string :reset_password_token
15
+ # t.datetime :reset_password_sent_at
16
+ # t.boolean :allow_password_change, :default => false
17
+
18
+ ## Rememberable
19
+ # t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ # t.integer :sign_in_count, :default => 0, :null => false
23
+ # t.datetime :current_sign_in_at
24
+ # t.datetime :last_sign_in_at
25
+ # t.string :current_sign_in_ip
26
+ # t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ # t.string :confirmation_token
30
+ # t.datetime :confirmed_at
31
+ # t.datetime :confirmation_sent_at
32
+ # t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
36
+ t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ t.datetime :locked_at
38
+
39
+ ## User Info
40
+ t.string :name
41
+ t.string :nickname
42
+ t.string :image
43
+ t.string :email
44
+
45
+ ## Tokens
46
+ if json_supported_database?
47
+ t.json :tokens
48
+ else
49
+ t.text :tokens
50
+ end
51
+
52
+ t.timestamps
53
+ end
54
+
55
+ add_index :lockable_users, :email
56
+ add_index :lockable_users, [:uid, :provider], :unique => true
57
+ # add_index :lockable_users, :reset_password_token, :unique => true
58
+ # add_index :lockable_users, :confirmation_token, :unique => true
59
+ add_index :lockable_users, :unlock_token, :unique => true
60
+ end
61
+ end
@@ -0,0 +1,258 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20160629184441) do
14
+
15
+ create_table "evil_users", force: :cascade do |t|
16
+ t.string "email"
17
+ t.string "encrypted_password", default: "", null: false
18
+ t.string "reset_password_token"
19
+ t.datetime "reset_password_sent_at"
20
+ t.boolean "allow_password_change", default: false
21
+ t.datetime "remember_created_at"
22
+ t.integer "sign_in_count", default: 0, null: false
23
+ t.datetime "current_sign_in_at"
24
+ t.datetime "last_sign_in_at"
25
+ t.string "current_sign_in_ip"
26
+ t.string "last_sign_in_ip"
27
+ t.string "confirmation_token"
28
+ t.datetime "confirmed_at"
29
+ t.datetime "confirmation_sent_at"
30
+ t.string "unconfirmed_email"
31
+ t.string "name"
32
+ t.string "nickname"
33
+ t.string "image"
34
+ t.string "provider"
35
+ t.string "uid", default: "", null: false
36
+ t.text "tokens"
37
+ t.string "favorite_color"
38
+ t.datetime "created_at"
39
+ t.datetime "updated_at"
40
+ t.index ["confirmation_token"], name: "index_evil_users_on_confirmation_token", unique: true
41
+ t.index ["email"], name: "index_evil_users_on_email"
42
+ t.index ["reset_password_token"], name: "index_evil_users_on_reset_password_token", unique: true
43
+ t.index ["uid", "provider"], name: "index_evil_users_on_uid_and_provider", unique: true
44
+ end
45
+
46
+ create_table "lockable_users", force: :cascade do |t|
47
+ t.string "provider", null: false
48
+ t.string "uid", default: "", null: false
49
+ t.string "encrypted_password", default: "", null: false
50
+ t.integer "failed_attempts", default: 0, null: false
51
+ t.string "unlock_token"
52
+ t.datetime "locked_at"
53
+ t.string "name"
54
+ t.string "nickname"
55
+ t.string "image"
56
+ t.string "email"
57
+ t.text "tokens"
58
+ t.datetime "created_at"
59
+ t.datetime "updated_at"
60
+ t.index ["email"], name: "index_lockable_users_on_email"
61
+ t.index ["uid", "provider"], name: "index_lockable_users_on_uid_and_provider", unique: true
62
+ t.index ["unlock_token"], name: "index_lockable_users_on_unlock_token", unique: true
63
+ end
64
+
65
+ create_table "mangs", force: :cascade do |t|
66
+ t.string "email"
67
+ t.string "encrypted_password", default: "", null: false
68
+ t.string "reset_password_token"
69
+ t.datetime "reset_password_sent_at"
70
+ t.string "reset_password_redirect_url"
71
+ t.boolean "allow_password_change", default: false
72
+ t.datetime "remember_created_at"
73
+ t.integer "sign_in_count", default: 0, null: false
74
+ t.datetime "current_sign_in_at"
75
+ t.datetime "last_sign_in_at"
76
+ t.string "current_sign_in_ip"
77
+ t.string "last_sign_in_ip"
78
+ t.string "confirmation_token"
79
+ t.datetime "confirmed_at"
80
+ t.datetime "confirmation_sent_at"
81
+ t.string "unconfirmed_email"
82
+ t.string "name"
83
+ t.string "nickname"
84
+ t.string "image"
85
+ t.string "provider"
86
+ t.string "uid", default: "", null: false
87
+ t.text "tokens"
88
+ t.datetime "created_at"
89
+ t.datetime "updated_at"
90
+ t.string "favorite_color"
91
+ t.index ["confirmation_token"], name: "index_mangs_on_confirmation_token", unique: true
92
+ t.index ["email"], name: "index_mangs_on_email"
93
+ t.index ["reset_password_token"], name: "index_mangs_on_reset_password_token", unique: true
94
+ t.index ["uid", "provider"], name: "index_mangs_on_uid_and_provider", unique: true
95
+ end
96
+
97
+ create_table "nice_users", force: :cascade do |t|
98
+ t.string "provider", null: false
99
+ t.string "uid", default: "", null: false
100
+ t.string "encrypted_password", default: "", null: false
101
+ t.string "reset_password_token"
102
+ t.datetime "reset_password_sent_at"
103
+ t.boolean "allow_password_change", default: false
104
+ t.datetime "remember_created_at"
105
+ t.integer "sign_in_count", default: 0, null: false
106
+ t.datetime "current_sign_in_at"
107
+ t.datetime "last_sign_in_at"
108
+ t.string "current_sign_in_ip"
109
+ t.string "last_sign_in_ip"
110
+ t.string "confirmation_token"
111
+ t.datetime "confirmed_at"
112
+ t.datetime "confirmation_sent_at"
113
+ t.string "unconfirmed_email"
114
+ t.string "name"
115
+ t.string "nickname"
116
+ t.string "image"
117
+ t.string "email"
118
+ t.text "tokens"
119
+ t.datetime "created_at"
120
+ t.datetime "updated_at"
121
+ t.index ["email"], name: "index_nice_users_on_email"
122
+ t.index ["reset_password_token"], name: "index_nice_users_on_reset_password_token", unique: true
123
+ t.index ["uid", "provider"], name: "index_nice_users_on_uid_and_provider", unique: true
124
+ end
125
+
126
+ create_table "only_email_users", force: :cascade do |t|
127
+ t.string "provider", null: false
128
+ t.string "uid", default: "", null: false
129
+ t.string "encrypted_password", default: "", null: false
130
+ t.string "name"
131
+ t.string "nickname"
132
+ t.string "image"
133
+ t.string "email"
134
+ t.text "tokens"
135
+ t.datetime "created_at"
136
+ t.datetime "updated_at"
137
+ t.index ["email"], name: "index_only_email_users_on_email"
138
+ t.index ["uid", "provider"], name: "index_only_email_users_on_uid_and_provider", unique: true
139
+ end
140
+
141
+ create_table "scoped_users", force: :cascade do |t|
142
+ t.string "provider", null: false
143
+ t.string "uid", default: "", null: false
144
+ t.string "encrypted_password", default: "", null: false
145
+ t.string "reset_password_token"
146
+ t.datetime "reset_password_sent_at"
147
+ t.boolean "allow_password_change", default: false
148
+ t.datetime "remember_created_at"
149
+ t.integer "sign_in_count", default: 0, null: false
150
+ t.datetime "current_sign_in_at"
151
+ t.datetime "last_sign_in_at"
152
+ t.string "current_sign_in_ip"
153
+ t.string "last_sign_in_ip"
154
+ t.string "confirmation_token"
155
+ t.datetime "confirmed_at"
156
+ t.datetime "confirmation_sent_at"
157
+ t.string "unconfirmed_email"
158
+ t.string "name"
159
+ t.string "nickname"
160
+ t.string "image"
161
+ t.string "email"
162
+ t.text "tokens"
163
+ t.datetime "created_at"
164
+ t.datetime "updated_at"
165
+ t.index ["email"], name: "index_scoped_users_on_email"
166
+ t.index ["reset_password_token"], name: "index_scoped_users_on_reset_password_token", unique: true
167
+ t.index ["uid", "provider"], name: "index_scoped_users_on_uid_and_provider", unique: true
168
+ end
169
+
170
+ create_table "unconfirmable_users", force: :cascade do |t|
171
+ t.string "provider", null: false
172
+ t.string "uid", default: "", null: false
173
+ t.string "encrypted_password", default: "", null: false
174
+ t.string "reset_password_token"
175
+ t.datetime "reset_password_sent_at"
176
+ t.boolean "allow_password_change", default: false
177
+ t.datetime "remember_created_at"
178
+ t.integer "sign_in_count", default: 0, null: false
179
+ t.datetime "current_sign_in_at"
180
+ t.datetime "last_sign_in_at"
181
+ t.string "current_sign_in_ip"
182
+ t.string "last_sign_in_ip"
183
+ t.string "name"
184
+ t.string "nickname"
185
+ t.string "image"
186
+ t.string "email"
187
+ t.text "tokens"
188
+ t.datetime "created_at"
189
+ t.datetime "updated_at"
190
+ t.index ["email"], name: "index_unconfirmable_users_on_email"
191
+ t.index ["reset_password_token"], name: "index_unconfirmable_users_on_reset_password_token", unique: true
192
+ t.index ["uid", "provider"], name: "index_unconfirmable_users_on_uid_and_provider", unique: true
193
+ end
194
+
195
+ create_table "unregisterable_users", force: :cascade do |t|
196
+ t.string "provider", null: false
197
+ t.string "uid", default: "", null: false
198
+ t.string "encrypted_password", default: "", null: false
199
+ t.string "reset_password_token"
200
+ t.datetime "reset_password_sent_at"
201
+ t.boolean "allow_password_change", default: false
202
+ t.datetime "remember_created_at"
203
+ t.integer "sign_in_count", default: 0, null: false
204
+ t.datetime "current_sign_in_at"
205
+ t.datetime "last_sign_in_at"
206
+ t.string "current_sign_in_ip"
207
+ t.string "last_sign_in_ip"
208
+ t.string "confirmation_token"
209
+ t.datetime "confirmed_at"
210
+ t.datetime "confirmation_sent_at"
211
+ t.string "unconfirmed_email"
212
+ t.string "name"
213
+ t.string "nickname"
214
+ t.string "image"
215
+ t.string "email"
216
+ t.text "tokens"
217
+ t.datetime "created_at"
218
+ t.datetime "updated_at"
219
+ t.index ["email"], name: "index_unregisterable_users_on_email"
220
+ t.index ["reset_password_token"], name: "index_unregisterable_users_on_reset_password_token", unique: true
221
+ t.index ["uid", "provider"], name: "index_unregisterable_users_on_uid_and_provider", unique: true
222
+ end
223
+
224
+ create_table "users", force: :cascade do |t|
225
+ t.string "email"
226
+ t.string "encrypted_password", default: "", null: false
227
+ t.string "reset_password_token"
228
+ t.datetime "reset_password_sent_at"
229
+ t.string "reset_password_redirect_url"
230
+ t.boolean "allow_password_change", default: false
231
+ t.datetime "remember_created_at"
232
+ t.integer "sign_in_count", default: 0, null: false
233
+ t.datetime "current_sign_in_at"
234
+ t.datetime "last_sign_in_at"
235
+ t.string "current_sign_in_ip"
236
+ t.string "last_sign_in_ip"
237
+ t.string "confirmation_token"
238
+ t.datetime "confirmed_at"
239
+ t.datetime "confirmation_sent_at"
240
+ t.string "unconfirmed_email"
241
+ t.string "name"
242
+ t.string "nickname"
243
+ t.string "image"
244
+ t.string "provider"
245
+ t.string "uid", default: "", null: false
246
+ t.text "tokens"
247
+ t.datetime "created_at"
248
+ t.datetime "updated_at"
249
+ t.integer "operating_thetan"
250
+ t.string "favorite_color"
251
+ t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
252
+ t.index ["email"], name: "index_users_on_email"
253
+ t.index ["nickname"], name: "index_users_on_nickname", unique: true
254
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
255
+ t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
256
+ end
257
+
258
+ end
@@ -0,0 +1,29 @@
1
+ module MigrationDatabaseHelper
2
+ def json_supported_database?
3
+ (postgres? && postgres_correct_version?) || (mysql? && mysql_correct_version?)
4
+ end
5
+
6
+ def postgres?
7
+ database_name == 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
8
+ end
9
+
10
+ def postgres_correct_version?
11
+ database_version > '9.3'
12
+ end
13
+
14
+ def mysql?
15
+ database_name == 'ActiveRecord::ConnectionAdapters::MysqlAdapter'
16
+ end
17
+
18
+ def mysql_correct_version?
19
+ database_version > '5.7.7'
20
+ end
21
+
22
+ def database_name
23
+ ActiveRecord::Base.connection.class.name
24
+ end
25
+
26
+ def database_version
27
+ ActiveRecord::Base.connection.select_value('SELECT VERSION()')
28
+ end
29
+ end