Rails 3, Ruby 1.9.2 и acts_as_taggable_on не играют хорошо - PullRequest
0 голосов
/ 21 августа 2010

Я переписываю свое приложение rails для работы с rails 3, и при переносе миграции activ_as_taggable_on я получаю эту ошибку:

==  CreatePosts: migrating ====================================================
-- create_table(:posts)
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "posts" already exists: CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "name" varchar(255), "email" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime) 
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `rescue in log'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract_adapter.rb:194:in `log'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/schema_statements.rb:167:in `create_table'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:383:in `block in method_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:359:in `block in say_with_time'
/usr/local/lib/ruby/1.9.1/benchmark.rb:294:in `measure'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:359:in `say_with_time'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:379:in `method_missing'
/media/usb0/thenw/db/migrate/20100820173109_create_posts.rb:3:in `up'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:312:in `block in migrate'
/usr/local/lib/ruby/1.9.1/benchmark.rb:294:in `measure'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:312:in `migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:395:in `migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:537:in `block (2 levels) in migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:611:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:611:in `block in ddl_transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/transactions.rb:204:in `transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:611:in `ddl_transaction'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:536:in `block in migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:523:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:523:in `migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:433:in `up'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/migration.rb:415:in `migrate'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/railties/databases.rake:140:in `block (2 levels) in <top (required)>'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `execute'
/usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'
/usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run'
/usr/local/bin/rake:31:in `<main>'

Я использую Ruby 1.9.2-p0, Rails 3.0.0.rc и Acts_As_Taggable_On 2.0.6.Acts_As_Taggable_On readme говорит, что он совместим с Ruby 1.9 и Rails 3 ... не уверен, что здесь не так.Есть указатели?

1 Ответ

1 голос
/ 21 августа 2010

Полагаю, вам нужно просто запустить db:migrate:reset, чтобы воссоздать ваши таблицы.Другой возможный способ - пропустить миграцию 20100820173109_create_posts.rb.

...