Problems with SQLite3

Hi!

I’ve got a very strange problem. Suddenly the SQLite3 Backend stopped
working.

Example 1:

rake db:rollback

== CreateProducts: reverting

– drop_table(:products)
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: near “CASCADE”: syntax error: DROP TABLE
“products” CASCADE

I googled for this error message, but didn’t find anything useful.

BTW, there is nothing special in the migration script:

class CreateProducts < ActiveRecord::Migration

def self.down
drop_table :products
end
end

Example 2:

rake test

Loaded suite
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
E
Finished in 0.046598 seconds.

  1. Error:
    test_product_attributes_must_not_be_empty(ProductTest):
    SystemStackError: stack level too deep
    /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rails_sql_views-0.8.0/lib/rails_sql_views/connection_adapters/abstract_adapter.rb:23

1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

It doesn’t matter, what is in the test. Any test will fail, even if I
just write ‘assert true’ there.

Those problems disappear if I change to another backend, for example
MySQL. Any Ideas?

P.S. My OS is Ubuntu Linux 10.10 with latest Updates. SQLite3 Version is
3.7.2-1ubuntu0.1.

On Mon, Mar 21, 2011 at 11:14 PM, Hashbang Hashbang
[email protected]wrote:

=================================================

rake test
SystemStackError: stack level too deep
MySQL. Any Ideas?

Your migration failed and you have a partially migrated database in
SQLite.
I would suggest dropping and recreating your test database by hand and
then
running your tests again.

B.

Bryan C. wrote in post #988721:

Your migration failed and you have a partially migrated database in
SQLite.
I would suggest dropping and recreating your test database by hand and
then running your tests again.

Unfortunately, that did not help. I deleted the database and recreated
it (BTW, this is a really simple test project with just one relation),
but I still get the same error. I still cannot do rake db:rollback in
the development environment. This is the output with --trace:

** Invoke db:rollback (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:rollback
== CreateProducts: reverting

– drop_table(:products)
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: near “CASCADE”: syntax error: DROP TABLE
“products” CASCADE
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:207:in
rescue in log' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:199:inlog’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in
execute' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rails_sql_views-0.8.0/lib/rails_sql_views/connection_adapters/abstract/schema_statements.rb:62:indrop_table_with_cascade’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:383:in
block in method_missing' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:359:inblock in say_with_time’
/home/vlad/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/benchmark.rb:294:in
measure' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:359:insay_with_time’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:379:in
method_missing' /home/vlad/workspace/depot/db/migrate/20110315224838_create_products.rb:14:indown’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:312:in
block in migrate' /home/vlad/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/benchmark.rb:294:inmeasure’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:312:in
migrate' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:395:inmigrate’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:537:in
block (2 levels) in migrate' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:611:incall’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:611:in
block in ddl_transaction' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract/database_statements.rb:139:intransaction’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/transactions.rb:207:in
transaction' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:611:inddl_transaction’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:536:in
block in migrate' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:523:ineach’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:523:in
migrate' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:437:indown’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:480:in
move' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/migration.rb:425:inrollback’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.0.5/lib/active_record/railties/databases.rake:211:in
block (2 levels) in <top (required)>' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:636:incall’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:636:in
block in execute' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:631:ineach’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:631:in
execute' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:597:inblock in invoke_with_call_chain’
/home/vlad/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in
mon_synchronize' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:583:in
invoke' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:in
block (2 levels) in top_level' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:ineach’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:in
block in top_level' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2023:in
top_level' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2001:inblock in run’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:1998:inrun’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake:31:in
<top (required)>' /home/vlad/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:inload’
/home/vlad/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `’

rake db:migrate run without any errors.