Monday, September 4, 2006

More ActiveRecord Information

Supporting More Databases

A number of folks have asked about support for database X. We want to support all possible databases, of course, and JDBC gives us a huge head start on that. Many databases will only need a bit of tweaking to support all the basic CRUD operations. The additional work...small though it may be...is implementing the schema-manipulating methods of ActiveRecord. Here's a complete list...if you can provide examples for each operation, it would speed our supporting them:
  • add_column
  • add_index
  • change_column
  • change_column_default
  • columns
  • create_table
  • drop_table
  • initialize_schema_information
  • native_database_types
  • remove_column
  • remove_index
  • rename_column
  • rename_table
  • structure_dump
  • table_alias_for
  • table_alias_length
Check available docs for ActiveRecord or look at the existing adapters in ActiveRecord in SVN for examples on each.

Avoiding Modifying active_record.rb

There's now a thread going on the Rails core mailing list and a bug to address the issue of adding adapters to Rails. Hopefully one of two things will come out of this:
  • "jdbc" will be added to the list of adapters available in core Rails
  • a mechanism will be added (or fixed) to allow adding to the list of adapters from outside the core source
The former would be ideal, since no additional, special config changes would be needed for jdbc versus MySQL, for example. The latter would be an "ok" compromise, but would require modifying all apps to add "jdbc" to the adapter list. I'll report back when something comes of it.

No comments:

Post a Comment