Provisioning database schemas in ruby
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.
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.
精彩评论