Hello Folks!
I only recently started to use Ruby on Rails coming from Delphi, which
is why I am quite happy with using InterBase as my database. 3rdRail
does come with an InterBase adapter but I could not run migrations
with Rails 2.1 and 3rdRail 2.0 against InterBase 2009. The error
occurred in ActiveRecord::Migrator when the get_all_versions method
was executed. It has some hard-coded SQL:
Base.connection.select_values(“SELECT version FROM #
{schema_migrations_table_name}”).map(&:to_i).sort
which caused a problem given that version is a reserved word in
InterBase.
I fixed the problem by freezing the rails 2.1 classes and introduced
the following patch:
version_column = Base.connection.quote_column_name(“version”)
Base.connection.select_values(“SELECT #{version_column} FROM #
{schema_migrations_table_name}”).map(&:to_i).sort
With this change the base connection can check for reserved words and
will wrap the name “version” into double quotes. The same problem
resurfaces in the private method record_version_state_after_migrating
of Migrator. It has some hard coded SQL for deleting or inserting a
version string into the schema_migrations table. Here I had to ask the
connection class for its version column name too. Whilst this is now
working (e.g. I can migrate) I don’t like this fix very much.
As far as I understand the Migrator class shouldn’t have any DB-
specific knowledge. Wouldn’t it be better to have a method on the
connection class to ask for all versions applied so far? And shouldn’t
the DB connection class be responsible for inserting or deleting a
version schema_migrations table?
I know this will cause that a whole bunch of adapters will have to
support those new methods. But from an pure OO perspective I think
this would be a better way to do migrations.
What do I need to do to submit such a change to the Rails core team
for consideration?
Thanks for a short answer in advance.
Salut,
Mathias