Hello,
I'm using rails-1.2.2 with ActiveRecord-1.15.2. I have a small feature request for ActiveRecord.
When creating a table, AR lets you add options to the whole table, but not for individual columns. I would like to be able to write:
t. column foo_id, :integer, :options => "CONSTRAINT fk_foo_id REFERENCES a(id) ON DELETE CASCADE"
Why? Because this syntax is accepted by both Oracle and Sqlite3 (although Sqlite3 silently ignores it), so the migration is portable.
However, if create the table first, and then do
execute %{alter table #{from_table} add constraint #{constraint_name} foreign key (#{from_column}) references #{to_table} (#{to_column})}
Sqlite3 rejects this with an exception. Sure I can rescue this:
rescue ActiveRecord::StatementInvalid => e raise unless /SQLite/ =~ e
It's just a bit ugly. But this is a minor point. AR rocks
Regards,
Brian.