petehamilton / citier

CITIER (Class Inheritance & Table Inheritance Embeddings for Rails) is a solution for simple Multiple Class Inheritance in Rails.
88 stars 24 forks source link

RSpec testing db:schema:load failure #32

Closed axsuul closed 13 years ago

axsuul commented 13 years ago

It seems to be failing to load the schema when performing testing via rspec. Doing rake spec I get

** Execute db:schema:load
rake aborted!
SQLite3::SQLException: near "CREATE": syntax error: CREATE VIEW "view_fruit_bananas" AS CREATE VIEW "view_fruit_bananas" AS SELECT ...

It appears to be repeating the CREATE VIEW "view_fruit_bananas" statement twice. Any suggestions? I am using DouweM's fork @ https://github.com/DouweM/citier.git. Thanks!

Is this gem still being developed?

DouweM commented 13 years ago

I'm not sure whether PeterHamilton is still working on the gem, but morgz, Garthex, myself and some other definitely are!

As for the problem: It appears to occur while executing db:schema:load, so whatever goes wrong is probably in your schema.rb file. Could you post the contents of this file so we can take a look at it?

axsuul commented 13 years ago

Thanks DouweM for all your work :) My project now totally depends on this gem!

Good to know that it's still being developed! Here is my schema.db that pertains to the error I'm getting, please let me know if there's anything else that might help.

create_view "view_piece_memories", "CREATE VIEW \"view_piece_memories\" AS SELECT pieces.id, type,created_at,updated_at,memory_type FROM pieces, piece_memories WHERE pieces.id = piece_memories.id", :force => true do |v|
    v.column :id
    v.column :type
    v.column :created_at
    v.column :updated_at
    v.column :memory_type
end

So yea, if i remove the CREATE VIEW \"view_piece_memories\" AS it appears to be working fine. So it looks like it's adding in an extra CREATE VIEW {view_name} AS?

DouweM commented 13 years ago

I think I've found the error, and it's inside rails_sql_views, the gem that's being used for creating the views and dumping them into the schema file. I'll try to fork, fix and push it later today/tomorrow. For now you can just manually remove the CREATE VIEW bit.

DouweM commented 13 years ago

I haven't been able to test it yet (I'm at school with nothing to use but a web browser), but you might want to try my fork of rails_sql_views.

Just specify git://github.com/DouweM/rails_sql_views.git as the Git source used for rails_sql_views in your Gemfile, and try dumping the schema.rb file again using rake db:schema:dump. If I'm right, it should now work fine.

axsuul commented 13 years ago

Yep just tested it, seems to work fine, thanks for all your help man :) Perhaps you should request a pull-up?

DouweM commented 13 years ago

I will when I find the time!

spekkola commented 12 years ago

Had the same problem as Axuul did. And yes, using git://github.com/DouweM/rails_sql_views.git as source fixed the problem. Thanks!