8 Nov 20:58
Re: extract fixtures from database?
On Nov 8, 2005, at 11:16 AM, Raphael Bauduin wrote:
>> # dump foobar db to ./foobar
>> $ rake dump_fixtures DB=foobar DEST=./foobar
> I get this error:
>
> rake aborted!
> undefined method `table_names' for
> #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb75e3cf4>
>
> I don't find the table_names method anywhere in the api. I looked for
> such a method in myslq but didn't either. Am I missing something
> obvious?
Oops! That's a method I defined. For PostgreSQL:
table_names = ActiveRecord::Base.connection.select_values(<<-end_sql)
SELECT c.relname
FROM pg_class c
LEFT JOIN pg_roles r ON r.oid = c.relowner
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','')
AND n.nspname IN ('myappschema', 'public')
AND pg_table_is_visible(c.oid)
end_sql
jeremy
RSS Feed