pivotalexperimental / desert

Desert is a component framework for Rails that allows your plugins have a Rails app like directory structure, routes, migrations, and dependencies.
http://desert.rubyforge.org
186 stars 31 forks source link

PostgreSQL compatibility #3

Open cariboo opened 15 years ago

cariboo commented 15 years ago

Each time i launch a rake db:migrate (while deploying the community engine plugin, which is based on desert, on a PostgreSQL database) i get the following error :

rake aborted! An error has occurred, this and all later migrations canceled:

RuntimeError: ERROR C25P02 Mcurrent transaction is aborted, commands ignored until end of transaction block Fpostgres.c L906 Rexec_simple_query: SELECT version FROM plugin_schema_migrations WHERE plugin_name = 'community_engine' order by version desc /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:212:in log' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:507:inexecute' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:985:in select_raw' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:972:inselect' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in select_all_without_query_cache' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:62:inselect_all' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in select_one' /var/lib/gems/1.8/gems/desert-0.5.0/lib/desert/plugin_migrations/2.1/migrator.rb:6:incurrent_version' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:384:in migrate' /var/lib/gems/1.8/gems/desert-0.5.0/lib/desert/plugin_migrations/migrator.rb:16:inmigrate_plugin' /var/lib/gems/1.8/gems/desert-0.5.0/lib/desert/rails/migration.rb:5:in migrate_plugin' ./db/migrate//20090811094445_community_engine_to_version_62.rb:3:inup_without_benchmarks' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:282:in send' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:282:inmigrate' /usr/lib/ruby/1.8/benchmark.rb:293:in measure' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:282:inmigrate' (DELEGATION):2:in __send__' (__DELEGATION__):2:inmigrate' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:486:in migrate' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:560:incall' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:560:in ddl_transaction' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:136:intransaction' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:182:in transaction' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:560:inddl_transaction' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:485:in migrate' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:472:ineach' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:472:in migrate' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:400:inup' /home/steph/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:383:in migrate' /home/steph/.gem/ruby/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:116 /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun' /home/steph/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19

The same deployement on a MySQL database is OK. Has desert been tested on PostgreSQL ? For your information, my PostgreSQL database version is 8.3 and my OS is Linux Ubuntu 9.04

andreierdoss commented 15 years ago

I have a fix for this in my repo - http://github.com/cauta/desert/tree/master . I hope that soon this will be added to the official repo.

ppg commented 15 years ago

Hi,

It appears the integration from cauta's fork happened, but it was done incorrectly; on line 10 the select_all uses plugin_schema_info when it should use plugin_schema_migrations (or even better the variable smt; also that should be used later in the file too :).

I'm still getting my github legs, otherwise I would have proposed a patch for this and theoretically a test to show the error; or is it better etiquette for me to fork this and make the changes there and propose they pick up? Curious for next time.