質問編集履歴
3
schema.rbを追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,4 +29,89 @@
|
|
29
29
|
|
30
30
|
そして、新しくPostモデルに新しくtitleカラムをデータ型integerで追加してみましたがこのエラーは消えません。調べてみても原因がわからず、このエラーの解決法、原因を教えていただけたら幸いです。
|
31
31
|
|
32
|
-
よろしくお願いいたします。
|
32
|
+
よろしくお願いいたします。
|
33
|
+
|
34
|
+
```db/schema.rb
|
35
|
+
# This file is auto-generated from the current state of the database. Instead
|
36
|
+
# of editing this file, please use the migrations feature of Active Record to
|
37
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
38
|
+
#
|
39
|
+
# Note that this schema.rb definition is the authoritative source for your
|
40
|
+
# database schema. If you need to create the application database on another
|
41
|
+
# system, you should be using db:schema:load, not running all the migrations
|
42
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
43
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
44
|
+
#
|
45
|
+
# It's strongly recommended that you check this file into your version control system.
|
46
|
+
|
47
|
+
ActiveRecord::Schema.define(version: 2020_10_11_130211) do
|
48
|
+
|
49
|
+
create_table "likes", force: :cascade do |t|
|
50
|
+
t.integer "word_user_id"
|
51
|
+
t.integer "word_id"
|
52
|
+
t.datetime "created_at", null: false
|
53
|
+
t.datetime "updated_at", null: false
|
54
|
+
end
|
55
|
+
|
56
|
+
create_table "posts", force: :cascade do |t|
|
57
|
+
t.text "content"
|
58
|
+
t.string "url"
|
59
|
+
t.string "next_url"
|
60
|
+
t.string "class_type"
|
61
|
+
t.string "image_url"
|
62
|
+
t.string "user_id"
|
63
|
+
t.datetime "created_at", null: false
|
64
|
+
t.datetime "updated_at", null: false
|
65
|
+
t.string "taiwan_beginner_1"
|
66
|
+
t.string "taiwan_beginner_cleared"
|
67
|
+
t.text "posts_title"
|
68
|
+
t.integer "title"
|
69
|
+
end
|
70
|
+
|
71
|
+
create_table "taiwan_beginner_1_posts", force: :cascade do |t|
|
72
|
+
t.text "content"
|
73
|
+
t.datetime "created_at", null: false
|
74
|
+
t.datetime "updated_at", null: false
|
75
|
+
t.integer "user_id"
|
76
|
+
end
|
77
|
+
|
78
|
+
create_table "taiwanbeginner1posts", force: :cascade do |t|
|
79
|
+
t.text "content"
|
80
|
+
t.integer "user_id"
|
81
|
+
t.datetime "created_at", null: false
|
82
|
+
t.datetime "updated_at", null: false
|
83
|
+
end
|
84
|
+
|
85
|
+
create_table "users", force: :cascade do |t|
|
86
|
+
t.string "provider"
|
87
|
+
t.string "uid"
|
88
|
+
t.string "name"
|
89
|
+
t.string "email"
|
90
|
+
t.string "image"
|
91
|
+
t.string "oauth_token"
|
92
|
+
t.datetime "oauth_expires_at"
|
93
|
+
t.datetime "created_at", null: false
|
94
|
+
t.datetime "updated_at", null: false
|
95
|
+
t.string "taiwan_daily_conversation_purchased"
|
96
|
+
t.string "taiwan_beginner_cleared"
|
97
|
+
t.string "taiwan_intermediate_cleared"
|
98
|
+
t.string "taiwan_daily_conversation_cleared"
|
99
|
+
t.string "taiwan_before_studying_abroad_cleared"
|
100
|
+
t.string "taiwan_before_studying_abroad_purchased"
|
101
|
+
t.string "taiwan_beginner_1_cleared"
|
102
|
+
t.string "taiwan_beginner_2_cleared"
|
103
|
+
end
|
104
|
+
|
105
|
+
create_table "words", force: :cascade do |t|
|
106
|
+
t.string "word_type"
|
107
|
+
t.string "word_user_id"
|
108
|
+
t.string "content"
|
109
|
+
t.string "meaning"
|
110
|
+
t.string "pronunciation"
|
111
|
+
t.datetime "created_at", null: false
|
112
|
+
t.datetime "updated_at", null: false
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
```
|
2
エラー文を追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,13 +7,24 @@
|
|
7
7
|
した際に以下のエラーが出ている事を見つけました。
|
8
8
|
|
9
9
|
```ターミナル
|
10
|
+
heroku run rails db:migrate
|
11
|
+
Running rails db:migrate on ⬢ teterako... up, run.2755 (Free)
|
12
|
+
D, [2020-10-11T13:11:01.732435 #4] DEBUG -- : (1.2ms) SELECT pg_try_advisory_lock(3591403873564692675)
|
13
|
+
D, [2020-10-11T13:11:01.752278 #4] DEBUG -- : (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
|
14
|
+
I, [2020-10-11T13:11:01.753656 #4] INFO -- : Migrating to ChangeDataUserIdToPosts (20200930145224)
|
15
|
+
D, [2020-10-11T13:11:01.757006 #4] DEBUG -- : (1.1ms) BEGIN
|
16
|
+
== 20200930145224 ChangeDataUserIdToPosts: migrating ==========================
|
17
|
+
-- change_column(:posts, :title, :integer)
|
18
|
+
D, [2020-10-11T13:11:01.759452 #4] DEBUG -- : (2.0ms) ALTER TABLE "posts" ALTER COLUMN "title" TYPE integer
|
19
|
+
D, [2020-10-11T13:11:01.760793 #4] DEBUG -- : (1.1ms) ROLLBACK
|
20
|
+
D, [2020-10-11T13:11:01.762427 #4] DEBUG -- : (1.3ms) SELECT pg_advisory_unlock(3591403873564692675)
|
10
21
|
rails aborted!
|
11
22
|
StandardError: An error has occurred, this and all later migrations canceled:
|
12
23
|
|
13
24
|
PG::DatatypeMismatch: ERROR: column "title" cannot be cast automatically to type integer
|
14
25
|
HINT: You might need to specify "USING title::integer".
|
26
|
+
: ALTER TABLE "posts" ALTER COLUMN "title" TYPE integer
|
15
27
|
```
|
16
|
-
|
17
28
|
以前にPostモデルのtitileカラムがなぜか数字しか出ず、データ型をtextからstringに変えたことが原因だと思い、Postモデルのtitileカラムを削除してみましたがこのエラーは消えず、、、
|
18
29
|
|
19
30
|
そして、新しくPostモデルに新しくtitleカラムをデータ型integerで追加してみましたがこのエラーは消えません。調べてみても原因がわからず、このエラーの解決法、原因を教えていただけたら幸いです。
|
1
文章を編集しました
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
heroku run rails db:migrate
|
1
|
+
heroku run rails db:migrateが通らない
|
body
CHANGED
@@ -12,4 +12,10 @@
|
|
12
12
|
|
13
13
|
PG::DatatypeMismatch: ERROR: column "title" cannot be cast automatically to type integer
|
14
14
|
HINT: You might need to specify "USING title::integer".
|
15
|
-
```
|
15
|
+
```
|
16
|
+
|
17
|
+
以前にPostモデルのtitileカラムがなぜか数字しか出ず、データ型をtextからstringに変えたことが原因だと思い、Postモデルのtitileカラムを削除してみましたがこのエラーは消えず、、、
|
18
|
+
|
19
|
+
そして、新しくPostモデルに新しくtitleカラムをデータ型integerで追加してみましたがこのエラーは消えません。調べてみても原因がわからず、このエラーの解決法、原因を教えていただけたら幸いです。
|
20
|
+
|
21
|
+
よろしくお願いいたします。
|