开发者

Provisioning database schemas in ruby

开发者 https://www.devze.com 2023-01-16 14:59 出处:网络
I\'m looking for a database agnostic way to create new 开发者_开发知识库schemas. Something like

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

精彩评论

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