質問編集履歴
2
加筆
test
CHANGED
File without changes
|
test
CHANGED
@@ -73,3 +73,167 @@
|
|
73
73
|
|
74
74
|
|
75
75
|
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
```ここに言語を入力
|
80
|
+
|
81
|
+
#api/db/migrate/20211006114511_devise_token_auth_create_users.rb
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.2]
|
86
|
+
|
87
|
+
def change
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
change_table(:users) do |t|
|
92
|
+
|
93
|
+
## Required
|
94
|
+
|
95
|
+
t.string :provider, :null => false, :default => "email"
|
96
|
+
|
97
|
+
t.string :uid, :null => false, :default => ""
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
## Database authenticatable
|
102
|
+
|
103
|
+
t.string :encrypted_password, :null => false, :default => ""
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
## Recoverable
|
108
|
+
|
109
|
+
t.string :reset_password_token
|
110
|
+
|
111
|
+
t.datetime :reset_password_sent_at
|
112
|
+
|
113
|
+
t.boolean :allow_password_change, :default => false
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
## Rememberable
|
118
|
+
|
119
|
+
t.datetime :remember_created_at
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
# 追記 --------------------------------------------
|
124
|
+
|
125
|
+
## Trackable
|
126
|
+
|
127
|
+
t.integer :sign_in_count, default: 0, null: false
|
128
|
+
|
129
|
+
t.datetime :current_sign_in_at
|
130
|
+
|
131
|
+
t.datetime :last_sign_in_at
|
132
|
+
|
133
|
+
t.string :current_sign_in_ip
|
134
|
+
|
135
|
+
t.string :last_sign_in_ip
|
136
|
+
|
137
|
+
# -----------------------------------------------------
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
## Confirmable
|
142
|
+
|
143
|
+
t.string :confirmation_token
|
144
|
+
|
145
|
+
t.datetime :confirmed_at
|
146
|
+
|
147
|
+
t.datetime :confirmation_sent_at
|
148
|
+
|
149
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
## Lockable
|
154
|
+
|
155
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
156
|
+
|
157
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
158
|
+
|
159
|
+
# t.datetime :locked_at
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
## User Info
|
164
|
+
|
165
|
+
# t.string :name
|
166
|
+
|
167
|
+
# t.string :nickname
|
168
|
+
|
169
|
+
t.string :image
|
170
|
+
|
171
|
+
# t.string :email
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
## Tokens
|
176
|
+
|
177
|
+
t.text :tokens
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
t.timestamps
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
add_index :users, :email, unique: true
|
188
|
+
|
189
|
+
add_index :users, [:uid, :provider], unique: true
|
190
|
+
|
191
|
+
add_index :users, :reset_password_token, unique: true
|
192
|
+
|
193
|
+
add_index :users, :confirmation_token, unique: true
|
194
|
+
|
195
|
+
# add_index :users, :unlock_token, unique: true
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
```
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
```ここに言語を入力
|
208
|
+
|
209
|
+
#api/db/migrate/20211007175252_create_users.rb
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
class CreateUsers < ActiveRecord::Migration[5.2]
|
214
|
+
|
215
|
+
def change
|
216
|
+
|
217
|
+
create_table :users do |t|
|
218
|
+
|
219
|
+
t.string :name
|
220
|
+
|
221
|
+
t.string :user_id
|
222
|
+
|
223
|
+
t.string :email
|
224
|
+
|
225
|
+
t.string :password
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
t.timestamps
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
```
|
1
加筆
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,11 +16,9 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
解決できる方おられますでしょうか。
|
19
|
+
初学者なので、初歩的な質問かもしれないですが、解決できる方おられますでしょうか。
|
20
20
|
|
21
|
-
他にソースコードが必要であれば
|
21
|
+
他にソースコードが必要であれば追加致します。
|
22
|
-
|
23
|
-
よろしくお願い致します。
|
24
22
|
|
25
23
|
|
26
24
|
|