views:

25

answers:

1

I'm looking for a database agnostic way to create new schemas. Something like

postgres_uri = "postgres://username:password@hostname/database"
mysql_uri = "mysql://username:password@hostname/database"

[postgres_uri, mysql_uri].each do |db|
  connection = DB.connect(db_uri)
  connection.create_schema("xyz")
end

Bonus marks for something that will work easily with the connection active_record establishes in rails.

A: 

The only thing that comes to mind is somehow having two active_record "instances" and running activerecord migrations on each. Sequel allows for the same thing, and even allows for string instance names.

rogerdpack
I've ended up using sequel with separate sqls for each database. I was hoping to avoid having to write code for each db but I couldn't find anything that would do it out of the box and the sql is pretty simple.
opsb