开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜