我试过了 ”AddvideoToQuestions video: references"
一个问题有_许多视频。一个视频属于一个问题。
试图 rake db:migrate
,并得到以下错误。
这是怎么回事?我终于深入研究 Rails 编码(我的第一种真正的语言),这个错误一直困扰着我。
SQLite3::SQLException:靠近“参考”:语法错误:ALTER TABLE“问题”添加“视频”参考/Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.7/lib /sqlite3/database.rb:91:在“初始化”中
@Marek Lipka - 尝试过并db:migrate
再次尝试 rake,但仍然是同样的错误。
以下是日志:
(抱歉——不熟悉如何呈现代码块。
QLite3::SQLException:靠近“参考”:语法错误:ALTER TABLE“问题”添加“视频”参考/Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.7/lib /sqlite3/database.rb:91:in
initialize' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in
new' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:inprepare' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:134:in
执行' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/sqlite_adapter.rb:278:inblock in execute' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
block in log' /Users/davidngo/. rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
log' /Users/davidngo/.rvm/gems/ruby-1.9.3 -p429/gems/activerecord-3.2.3/lib/active_record/connection_adapter/sqlite_adapter.rb:278:inexecute' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:264:in
add_column'add_column' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:466:in
/Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/sqlite_adapter.rb:400:in block in method_missing'/Users/davidngo/ .rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:438:inblock in say_with_time' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:438:in
say_with_time' /Users/davidngo/.rvm/gems/ruby-1.9.3- p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:458:inmethod_missing' /Users/davidngo/Desktop/Coding/RoR_Practice/videxpert/db/migrate/20130809091631_add_video_to_question.rb:3:in
change' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib /active_record/migration.rb:407:inblock (2 levels) in migrate' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:407:in
block in migrate' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool。 RB:119:在with_connection' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:389:in
迁移' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:528:inmigrate' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:720:in
block (2 levels) in migrate' /Users/ davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:incall' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in
block in ddl_transaction' /Users/davidngo/.rvm/gems/ruby- 1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:intransaction' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/transactions.rb:208:in
transaction' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems /activerecord-3.2.3/lib/active_record/migration.rb:775:inddl_transaction' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:719:in
block in migrate' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/ active_record/migration.rb:700:ineach' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:700:in
migrate'/Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:570:在up' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/migration.rb:551:in
迁移' /Users/davidngo/.rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.3/lib/active_record/railties/databases.rake:153:in 'block (2 levels) in '