0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ディレクトリ間違えてrake db:drop db:create db:migrateした時のメモ

Last updated at Posted at 2019-04-16

rails s して ローカル表示しようとしたらこんなのがでた

error
ActiveRecord::NoEnvironmentInSchemaError:

Environment data not found in the schema. To resolve this issue, 
run:bin/rails db:environment:set RAILS_ENV=development

が、rails db:environment:set RAILS_ENV=developmentすると

== 20190328182436 ChangeContextToContent: migrating ===========================
-- add_column(:posts, :content, :text)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

その下の方を見ていくと
SQLite3::SQLException: duplicate column name: content: ALTER TABLE "posts" ADD "content" text

postsテーブルにcontentカラムが存在している?
同じ定義が複数あるのではないかということらしい。

migrationファイルを見直して、なんか丸々一ついらないmigrationファイルがあったので削除、なんで。。

違う箇所にも同じような Caused by: SQLite3::SQLException: duplicate column name: content というのが出ていたし、よ〜く読んで考えるようにしよ。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?