incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Recordon (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HERALDRY-4) the Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box
Date Fri, 02 Mar 2007 19:53:50 GMT

    [ https://issues.apache.org/jira/browse/HERALDRY-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477422
] 

David Recordon commented on HERALDRY-4:
---------------------------------------

So I'm not familiar enough with Postgres anymore...

Looks like the first two patches add quotes around the number 1.  I'm assuming this is due
to Postgres treating the number as a string and thus requiring quotes.?.

I'm also a bit at a loss as to the last patch.  What does the SELECT setval do for Postgres?

Thanks!

> the Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box
> ------------------------------------------------------------------------------------
>
>                 Key: HERALDRY-4
>                 URL: https://issues.apache.org/jira/browse/HERALDRY-4
>             Project: Heraldry
>          Issue Type: Improvement
>            Reporter: Ward Vandewege
>
> The Ruby Heraldry OpenID server does not support a PostgreSQL backend out of the box.
These two patches are simple fixes that will not affect MySQL:
> --- app/models/property_type.rb (revision 508264)
> +++ app/models/property_type.rb (working copy)
> @@ -52,7 +52,7 @@
>      # ====Parameters
>      # user:: The User for whom we're finding PropertyTypes.
>      def roots_global_or_owned_by(user)
> -      find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= 1 OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at ASC')
> +      find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= \'1\' OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at
ASC')
>      end
>    end
> --- db/migrate/026_reorder_personal_property_types.rb   (revision 508264)
> +++ db/migrate/026_reorder_personal_property_types.rb   (working copy)
> @@ -43,7 +43,7 @@
>        end
>  
>        def roots_global_or_owned_by(user)
> -        find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= 1 OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at ASC')
> +        find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global
= \'1\' OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at
ASC')
>        end
>      end
>  
> Finally, this patch is also necessary, but it needs a bit of work:
> --- db/migrate/022_globalize_migration.rb       (revision 508264)
> +++ db/migrate/022_globalize_migration.rb       (working copy)
> @@ -65,6 +65,13 @@
>        t.column :scope, :string, :limit => 1
>      end
>  
> +    # Added for PostgresSQL
> +    tables = ['globalize_countries', 'globalize_translations', 'globalize_languages']
> +      tables.each do |table|
> +      sql = "SELECT setval('#{table}_id_seq', 1)" 
> +      ActiveRecord::Base.connection.execute(sql)
> +    end
> +
>      add_index :globalize_languages, :iso_639_1
>      add_index :globalize_languages, :iso_639_2  
>      add_index :globalize_languages, :iso_639_3  
> The problem is that the rake db:migrate command fails because PostgreSQL does not allow
using currval on a sequence that has not been used in the current session. This patch fixes
this, but it will break MySQL support. A detection of the database backend needs to be added
to it before it goes into the svn tree.
> Any questions, please feel free to contact me.
> Thanks,
> Ward.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message