I have the following migration and I want to be able to check if the current database related to the environment is a mysql database. If it\'s mysql then I want to execute
There is an adapter_name in AbstractAdapter and that is there since Rails2.
So it's easier to use in the migration like this:
adapter_type = connection.adapter_name.downcase.to_sym
case adapter_type
when :mysql, :mysql2
# do the MySQL part
when :sqlite
# do the SQLite3 part
when :postgresql
# etc.
else
raise NotImplementedError, "Unknown adapter type '#{adapter_type}'"
end