質問編集履歴

3

誤字

2019/10/03 06:45

投稿

nista
nista

スコア14

test CHANGED
File without changes
test CHANGED
@@ -22,9 +22,9 @@
22
22
 
23
23
  > Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
24
24
 
25
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
25
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
26
26
 
27
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
27
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
28
28
 
29
29
 
30
30
 
@@ -32,9 +32,9 @@
32
32
 
33
33
  ActiveRecord::StatementInvalid: Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
34
34
 
35
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
35
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
36
36
 
37
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
37
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
38
38
 
39
39
 
40
40
 
@@ -42,9 +42,9 @@
42
42
 
43
43
  Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist
44
44
 
45
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
45
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
46
46
 
47
- /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
47
+ /projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:5:in `up'
48
48
 
49
49
  Tasks: TOP => db:migrate
50
50
 

2

表記の変更

2019/10/03 06:45

投稿

nista
nista

スコア14

test CHANGED
File without changes
test CHANGED
@@ -14,15 +14,13 @@
14
14
 
15
15
  # エラーメッセージ
16
16
 
17
-
18
-
19
- rake aborted!
17
+ > rake aborted!
20
18
 
21
19
  StandardError: An error has occurred, all later migrations canceled:
22
20
 
23
21
 
24
22
 
25
- Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
23
+ > Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
26
24
 
27
25
  /Users/taiponista1/projects/freemarket_sample_50c/db/migrate/20191002055101_add_devise_to_users.rb:7:in `block in up'
28
26
 
@@ -30,7 +28,7 @@
30
28
 
31
29
 
32
30
 
33
- Caused by:
31
+ > Caused by:
34
32
 
35
33
  ActiveRecord::StatementInvalid: Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
36
34
 
@@ -40,7 +38,7 @@
40
38
 
41
39
 
42
40
 
43
- Caused by:
41
+ > Caused by:
44
42
 
45
43
  Mysql2::Error: Table 'freemarket_sample_50c_development.users' doesn't exist
46
44
 

1

コードの追記

2019/10/02 13:54

投稿

nista
nista

スコア14

test CHANGED
File without changes
test CHANGED
@@ -52,6 +52,116 @@
52
52
 
53
53
 
54
54
 
55
+ # 20191002055101_add_devise_to_users.rb
56
+
57
+ ```
58
+
59
+ # frozen_string_literal: true
60
+
61
+
62
+
63
+ class AddDeviseToUsers < ActiveRecord::Migration[5.2]
64
+
65
+ def self.up
66
+
67
+ change_table :users do |t|
68
+
69
+ ## Database authenticatable
70
+
71
+ t.string :email, null: false, default: ""
72
+
73
+ t.string :encrypted_password, null: false, default: ""
74
+
75
+
76
+
77
+ ## Recoverable
78
+
79
+ t.string :reset_password_token
80
+
81
+ t.datetime :reset_password_sent_at
82
+
83
+
84
+
85
+ ## Rememberable
86
+
87
+ t.datetime :remember_created_at
88
+
89
+
90
+
91
+ ## Trackable
92
+
93
+ # t.integer :sign_in_count, default: 0, null: false
94
+
95
+ # t.datetime :current_sign_in_at
96
+
97
+ # t.datetime :last_sign_in_at
98
+
99
+ # t.string :current_sign_in_ip
100
+
101
+ # t.string :last_sign_in_ip
102
+
103
+
104
+
105
+ ## Confirmable
106
+
107
+ # t.string :confirmation_token
108
+
109
+ # t.datetime :confirmed_at
110
+
111
+ # t.datetime :confirmation_sent_at
112
+
113
+ # t.string :unconfirmed_email # Only if using reconfirmable
114
+
115
+
116
+
117
+ ## Lockable
118
+
119
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
120
+
121
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
122
+
123
+ # t.datetime :locked_at
124
+
125
+
126
+
127
+
128
+
129
+ # Uncomment below if timestamps were not included in your original model.
130
+
131
+ # t.timestamps null: false
132
+
133
+ end
134
+
135
+
136
+
137
+ add_index :users, :email, unique: true
138
+
139
+ add_index :users, :reset_password_token, unique: true
140
+
141
+ # add_index :users, :confirmation_token, unique: true
142
+
143
+ # add_index :users, :unlock_token, unique: true
144
+
145
+ end
146
+
147
+
148
+
149
+ def self.down
150
+
151
+ # By default, we don't want to make any assumption about how to roll back a migration when your
152
+
153
+ # model already existed. Please edit below which fields you would like to remove in this migration.
154
+
155
+ raise ActiveRecord::IrreversibleMigration
156
+
157
+ end
158
+
159
+ end
160
+
161
+ ```
162
+
163
+
164
+
55
165
  # 試したこと
56
166
 
57
167
  rake db:reset → 再度 rake db:migrate