Problem with Oracle function-based indexes in Rails


We're using Rails on an Oracle database. If we define an index like the following, we end up with problems during the "db:schema:dump" rake target.

  add_index "emcolumn", ["upper(name)"], :name => "ind_emcolumn_uname"

The created schema.rb file contains:

  add_index "emcolumn", ["sys_nc00013$"], :name => "ind_emcolumn_uname"

Well, we are aware we can use "config.active_record.schema_format = :sql" to fall back to a SQL file containing only table definition statements. However it would be nice if the Oracle adapter would understand such constructs. A possible solution for this problem is attached as patch against Rails 1.2 RC1.

I'm quite sure it's not perfect yet. Maybe someone can pick up the idea and improve it to make it ready to go into the official sources.

Best Regards, Andreas Gungl

rails-oracle-patch.diff (1.63 KB)

I'll take a look at the patch, but I'm a bit dubious at the start -- this quickly becomes a rabbit hole, as you start to get into user-defined functions, etc. It may just be that skipping functional indexes in the dump is the safest bet, and allow folks to support them manually. wrote: