我该如何解决这个问题?
我在本地运行rake db:migrate成功没有问题。但是在Heroku上,我明白了。
当我运行heroku时运行rake db:migrate --trace
$ heroku run rake db:migrate --trace
WARNING: Toolbelt is currently updating
Running rake db:migrate --trace on project-michelangelo... up, run.3483
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
Migrating to AddAttachmentAvatarToUsers (20160209034141)
== 20160209034141 AddAttachmentAvatarToUsers: migrating =======================
-- change_table(:users)
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)/app/v
endor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connection_ad
apters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "avatar_file
_name" of relation "users" already exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
这是我的schema.rb,只有users表
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
更新:
分贝/迁移
class AddAttachmentAvatarToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.attachment :avatar
end
end
def self.down
remove_attachment :users, :avatar
end
end