質問編集履歴

1

rails db:migrate RAILS_ENV=productionの実行で新たなエラーが出てしまいました。

2020/09/21 10:42

投稿

amby
amby

スコア40

test CHANGED
File without changes
test CHANGED
@@ -43,3 +43,101 @@
43
43
  (See full trace by running task with --trace)
44
44
 
45
45
  ```
46
+
47
+
48
+
49
+ ### 新たなエラー
50
+
51
+ 「rails db:migrate RAILS_ENV=production」を実行すると下記のようなエラーがでます。
52
+
53
+ ```
54
+
55
+ [ec2-user@ip-172-31-35-175 portfolio]$ rails db:migrate RAILS_ENV=production
56
+
57
+ == 20200802224225 DropTableMicroposts: migrating ==============================
58
+
59
+ -- drop_table(:microposts)
60
+
61
+ rails aborted!
62
+
63
+ StandardError: An error has occurred, all later migrations canceled:
64
+
65
+
66
+
67
+ Mysql2::Error: Unknown table 'portfolio_production.microposts': DROP TABLE `microposts`
68
+
69
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
70
+
71
+ bin/rails:4:in `<main>'
72
+
73
+
74
+
75
+ Caused by:
76
+
77
+ ActiveRecord::StatementInvalid: Mysql2::Error: Unknown table 'portfolio_production.microposts': DROP TABLE `microposts`
78
+
79
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
80
+
81
+ bin/rails:4:in `<main>'
82
+
83
+
84
+
85
+ Caused by:
86
+
87
+ Mysql2::Error: Unknown table 'portfolio_production.microposts'
88
+
89
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
90
+
91
+ bin/rails:4:in `<main>'
92
+
93
+ Tasks: TOP => db:migrate
94
+
95
+ (See full trace by running task with --trace)
96
+
97
+ [ec2-user@ip-172-31-35-175 portfolio]$ ails db:migrate RAILS_ENV=production
98
+
99
+ -bash: ails: コマンドが見つかりません
100
+
101
+ [ec2-user@ip-172-31-35-175 portfolio]$ rails db:migrate RAILS_ENV=production
102
+
103
+ == 20200802224225 DropTableMicroposts: migrating ==============================
104
+
105
+ -- drop_table(:microposts)
106
+
107
+ rails aborted!
108
+
109
+ StandardError: An error has occurred, all later migrations canceled:
110
+
111
+
112
+
113
+ Mysql2::Error: Unknown table 'portfolio_production.microposts': DROP TABLE `microposts`
114
+
115
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
116
+
117
+ bin/rails:4:in `<main>'
118
+
119
+
120
+
121
+ Caused by:
122
+
123
+ ActiveRecord::StatementInvalid: Mysql2::Error: Unknown table 'portfolio_production.microposts': DROP TABLE `microposts`
124
+
125
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
126
+
127
+ bin/rails:4:in `<main>'
128
+
129
+
130
+
131
+ Caused by:
132
+
133
+ Mysql2::Error: Unknown table 'portfolio_production.microposts'
134
+
135
+ /var/www/portfolio/db/migrate/20200802224225_drop_table_microposts.rb:3:in `change'
136
+
137
+ bin/rails:4:in `<main>'
138
+
139
+ Tasks: TOP => db:migrate
140
+
141
+ (See full trace by running task with --trace)
142
+
143
+ ```