[Ovirt-devel] [PATCH 1/3] Add foreigner plugin from Matthu Higgins, allowing to manage foreign key in a multi-db way.
Mohammed Morsi
mmorsi at redhat.com
Wed Oct 14 19:13:29 UTC 2009
Michel Loiseleur wrote:
> ....
> --- /dev/null
> +++ b/src/vendor/plugins/foreigner/lib/foreigner/connection_adapters/postgresql_adapter.rb
> @@ -0,0 +1,46 @@
> +module Foreigner
> + module ConnectionAdapters
> + module PostgreSQLAdapter
> + include Foreigner::ConnectionAdapters::Sql2003
> +
> + def foreign_keys(table_name)
> + fk_info = select_all %{
> + SELECT tc.constraint_name as name
> + ,ccu.table_name as to_table
> + ,ccu.column_name as primary_key
> + ,kcu.column_name as column
> + ,rc.delete_rule as dependency
> + FROM information_schema.table_constraints tc
> + JOIN information_schema.key_column_usage kcu
> + USING (constraint_catalog, constraint_schema, constraint_name)
> + JOIN information_schema.referential_constraints rc
> + USING (constraint_catalog, constraint_schema, constraint_name)
> + JOIN information_schema.constraint_column_usage ccu
> + USING (constraint_catalog, constraint_schema, constraint_name)
> + WHERE tc.constraint_type = 'FOREIGN KEY'
> + AND tc.constraint_catalog = '#{@config[:database]}'
> + AND tc.table_name = '#{table_name}'
> + }
> +
> + fk_info.map do |row|
> + options = {:column => row['column'], :name => row['name'], :primary_key = row['primary_key']}
>
Syntax error here prevents mongrel from starting up, the last "=" should
be changed to a "=>" like so
:primary_key => row['primary_key']
After I fix this mongrel/rails starts up and the wui works again.
-Mo
More information about the ovirt-devel
mailing list