赞some others , 我遇到了错误
"ActiveRecord::StatementInvalid: SQLite3::SQLException: object name reserved for internal use: sqlite_sp_functions: CREATE TABLE "sqlite_sp_functions" ("name" text, "text" text)"
运行时rake test
在 Rails 项目上。
schema.rb
中的违规行是:
create_table "sqlite_sp_functions", id: false, force: true do |t|
t.text "name"
t.text "text"
end
关于之前关于此的查询的建议涉及编辑 schema.rb
或删除该文件并重新生成它,但是 schema.rb
(以及有问题的代码)在每次迁移时都会重新生成(另外,我不想在不知道其含义的情况下删除 Rails 生成的代码),所以这并不是一个真正令人满意的解决方案。
那么 sqlite_sp_functions
是什么?表,以及如何让 Rails 生成 schema.rb
不会损坏的文件 rake test
对于项目?
最佳答案
根据 https://stackoverflow.com/a/25077833/601782 :
Add the following config line to
config/application.rb
or inconfig/environments/development.rb
:ActiveRecord::SchemaDumper.ignore_tables = /^sqlite_*/
This will ignore all tables starting with "sqlite_" in your database during the schema dump.
关于ruby-on-rails - Rails schema.rb 中 sqlite_sp_functions 的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23755282/