質問編集履歴

3

schema.rbを追記しました

2020/10/12 07:15

投稿

yukikiti
yukikiti

スコア1

test CHANGED
File without changes
test CHANGED
@@ -61,3 +61,173 @@
61
61
 
62
62
 
63
63
  よろしくお願いいたします。
64
+
65
+
66
+
67
+ ```db/schema.rb
68
+
69
+ # This file is auto-generated from the current state of the database. Instead
70
+
71
+ # of editing this file, please use the migrations feature of Active Record to
72
+
73
+ # incrementally modify your database, and then regenerate this schema definition.
74
+
75
+ #
76
+
77
+ # Note that this schema.rb definition is the authoritative source for your
78
+
79
+ # database schema. If you need to create the application database on another
80
+
81
+ # system, you should be using db:schema:load, not running all the migrations
82
+
83
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
84
+
85
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
86
+
87
+ #
88
+
89
+ # It's strongly recommended that you check this file into your version control system.
90
+
91
+
92
+
93
+ ActiveRecord::Schema.define(version: 2020_10_11_130211) do
94
+
95
+
96
+
97
+ create_table "likes", force: :cascade do |t|
98
+
99
+ t.integer "word_user_id"
100
+
101
+ t.integer "word_id"
102
+
103
+ t.datetime "created_at", null: false
104
+
105
+ t.datetime "updated_at", null: false
106
+
107
+ end
108
+
109
+
110
+
111
+ create_table "posts", force: :cascade do |t|
112
+
113
+ t.text "content"
114
+
115
+ t.string "url"
116
+
117
+ t.string "next_url"
118
+
119
+ t.string "class_type"
120
+
121
+ t.string "image_url"
122
+
123
+ t.string "user_id"
124
+
125
+ t.datetime "created_at", null: false
126
+
127
+ t.datetime "updated_at", null: false
128
+
129
+ t.string "taiwan_beginner_1"
130
+
131
+ t.string "taiwan_beginner_cleared"
132
+
133
+ t.text "posts_title"
134
+
135
+ t.integer "title"
136
+
137
+ end
138
+
139
+
140
+
141
+ create_table "taiwan_beginner_1_posts", force: :cascade do |t|
142
+
143
+ t.text "content"
144
+
145
+ t.datetime "created_at", null: false
146
+
147
+ t.datetime "updated_at", null: false
148
+
149
+ t.integer "user_id"
150
+
151
+ end
152
+
153
+
154
+
155
+ create_table "taiwanbeginner1posts", force: :cascade do |t|
156
+
157
+ t.text "content"
158
+
159
+ t.integer "user_id"
160
+
161
+ t.datetime "created_at", null: false
162
+
163
+ t.datetime "updated_at", null: false
164
+
165
+ end
166
+
167
+
168
+
169
+ create_table "users", force: :cascade do |t|
170
+
171
+ t.string "provider"
172
+
173
+ t.string "uid"
174
+
175
+ t.string "name"
176
+
177
+ t.string "email"
178
+
179
+ t.string "image"
180
+
181
+ t.string "oauth_token"
182
+
183
+ t.datetime "oauth_expires_at"
184
+
185
+ t.datetime "created_at", null: false
186
+
187
+ t.datetime "updated_at", null: false
188
+
189
+ t.string "taiwan_daily_conversation_purchased"
190
+
191
+ t.string "taiwan_beginner_cleared"
192
+
193
+ t.string "taiwan_intermediate_cleared"
194
+
195
+ t.string "taiwan_daily_conversation_cleared"
196
+
197
+ t.string "taiwan_before_studying_abroad_cleared"
198
+
199
+ t.string "taiwan_before_studying_abroad_purchased"
200
+
201
+ t.string "taiwan_beginner_1_cleared"
202
+
203
+ t.string "taiwan_beginner_2_cleared"
204
+
205
+ end
206
+
207
+
208
+
209
+ create_table "words", force: :cascade do |t|
210
+
211
+ t.string "word_type"
212
+
213
+ t.string "word_user_id"
214
+
215
+ t.string "content"
216
+
217
+ t.string "meaning"
218
+
219
+ t.string "pronunciation"
220
+
221
+ t.datetime "created_at", null: false
222
+
223
+ t.datetime "updated_at", null: false
224
+
225
+ end
226
+
227
+
228
+
229
+ end
230
+
231
+
232
+
233
+ ```

2

エラー文を追加しました

2020/10/12 07:15

投稿

yukikiti
yukikiti

スコア1

test CHANGED
File without changes
test CHANGED
@@ -16,6 +16,28 @@
16
16
 
17
17
  ```ターミナル
18
18
 
19
+ heroku run rails db:migrate
20
+
21
+ Running rails db:migrate on ⬢ teterako... up, run.2755 (Free)
22
+
23
+ D, [2020-10-11T13:11:01.732435 #4] DEBUG -- : (1.2ms) SELECT pg_try_advisory_lock(3591403873564692675)
24
+
25
+ D, [2020-10-11T13:11:01.752278 #4] DEBUG -- : (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
26
+
27
+ I, [2020-10-11T13:11:01.753656 #4] INFO -- : Migrating to ChangeDataUserIdToPosts (20200930145224)
28
+
29
+ D, [2020-10-11T13:11:01.757006 #4] DEBUG -- : (1.1ms) BEGIN
30
+
31
+ == 20200930145224 ChangeDataUserIdToPosts: migrating ==========================
32
+
33
+ -- change_column(:posts, :title, :integer)
34
+
35
+ D, [2020-10-11T13:11:01.759452 #4] DEBUG -- : (2.0ms) ALTER TABLE "posts" ALTER COLUMN "title" TYPE integer
36
+
37
+ D, [2020-10-11T13:11:01.760793 #4] DEBUG -- : (1.1ms) ROLLBACK
38
+
39
+ D, [2020-10-11T13:11:01.762427 #4] DEBUG -- : (1.3ms) SELECT pg_advisory_unlock(3591403873564692675)
40
+
19
41
  rails aborted!
20
42
 
21
43
  StandardError: An error has occurred, this and all later migrations canceled:
@@ -26,9 +48,9 @@
26
48
 
27
49
  HINT: You might need to specify "USING title::integer".
28
50
 
51
+ : ALTER TABLE "posts" ALTER COLUMN "title" TYPE integer
52
+
29
53
  ```
30
-
31
-
32
54
 
33
55
  以前にPostモデルのtitileカラムがなぜか数字しか出ず、データ型をtextからstringに変えたことが原因だと思い、Postモデルのtitileカラムを削除してみましたがこのエラーは消えず、、、
34
56
 

1

文章を編集しました

2020/10/12 01:38

投稿

yukikiti
yukikiti

スコア1

test CHANGED
@@ -1 +1 @@
1
- heroku run rails db:migrateでエラーPG::DatatypeMismatch: ERROR....
1
+ heroku run rails db:migrateが通らない
test CHANGED
@@ -27,3 +27,15 @@
27
27
  HINT: You might need to specify "USING title::integer".
28
28
 
29
29
  ```
30
+
31
+
32
+
33
+ 以前にPostモデルのtitileカラムがなぜか数字しか出ず、データ型をtextからstringに変えたことが原因だと思い、Postモデルのtitileカラムを削除してみましたがこのエラーは消えず、、、
34
+
35
+
36
+
37
+ そして、新しくPostモデルに新しくtitleカラムをデータ型integerで追加してみましたがこのエラーは消えません。調べてみても原因がわからず、このエラーの解決法、原因を教えていただけたら幸いです。
38
+
39
+
40
+
41
+ よろしくお願いいたします。