2017-01-15 23 views
0

私のアプリでPaperclip gemを使用していましたが、削除してもう一度追加したいと思います。しかし、私はこのエラーを取得しています私はrake db:migrateにしようとすると:レールの移行で重複する列を削除します

2.3.0 :001 > Post.column_names 
    => ["id", "title", "link", "description", "created_at", "updated_at", "user_id", "image_file_name", "image_content_type", "image_file_size", "image_updated_at", "cached_votes_total", "cached_votes_score", "cached_votes_up", "cached_votes_down", "cached_weighted_score", "cached_weighted_total", "cached_weighted_average", "image"] 

私は「イメージ_ファイルの_名前」を削除する方法があることを知っている:

ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations" 
Migrating to AddAttachmentImageToPosts (20170115210207) 
    (0.3ms) BEGIN 
== 20170115210207 AddAttachmentImageToPosts: migrating ======================== 
-- change_table(:posts) 
    (0.9ms) ALTER TABLE "posts" ADD "image_file_name" character varying 
    (0.2ms) ROLLBACK 
rake aborted! 
StandardError: An error has occurred, this and all later migrations canceled: 

PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists 
: ALTER TABLE "posts" ADD "image_file_name" character varying 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>' 
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists 
: ALTER TABLE "posts" ADD "image_file_name" character varying 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>' 
PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing' 
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate' 
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval' 
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>' 
Tasks: TOP => db:migrate 
(See full trace by running task with --trace) 

私はrails cを走った、これは私が得たものです私は本当に私のアプリにそうする方法を認識していない。私は私の問題に似たいくつかの記事を見つけましたが、何も本当に解決しませんでした!

+0

あなたはすでに、なぜあなたは再びそれを追加しようとしているそのフィールドを持っている場合は? –

+0

前にPaperclipを削除したときに...私もそのマイグレーションを削除しました – hekmat

+0

あなたの添付ファイルや検証を追加したモデルにコメントしてから、マイグレーションファイルを実行します。 – Milind

答えて

0

まず、移行を削除するだけではありません。フィールドを削除する場合は、新しい移行を作成する必要があります。

データベース全体を再作成するrake db:migration:reset、またはrake db:migration:resetがあります。この最後の移行時にコンテンツにコメントすることができます。rake db:migrateを実行した後、コメントを解除できます。

+0

私は2番目のオプションを実行し、db:migrateを実行しました。しかし、画像をアップロードしようとすると、 'image_file_name 'に必要なattr_accessorがありません投稿モデル – hekmat

+0

' rake db:migration:rest'を今すぐ試すべきでしょうか? – hekmat

0

列を作成するために移行を削除したため、移行を作成して削除すると、最初に削除する列がないため、他の環境(運用)でエラーが発生します。

本番環境への移行を導入していないと仮定します。 データベースコンソールに直接カラムをドロップすることができます。

実行rails dbconsole

ALTER TABLE posts DROP COLUMN image_file_name; 
関連する問題