Cross-database queries with different DB names in different environments?

前端 未结 2 1594
没有蜡笔的小新
没有蜡笔的小新 2021-01-16 01:41

How would you handle cross database queries in different environments. For example, db1-development and db2-development, db1-production and db2-production.

If I wa

2条回答
  •  自闭症患者
    2021-01-16 02:02

    Why are the database names different between dev and prod? It'd, obviously, be easiest if they were the same.

    If it's a single table shared, then you could create a view over it - which only requires that you change that view when moving to production.

    Otherwise, you'll want to create a SYNONYM for the objects, and make sure to always reference that. You'll still need to change the SYNONYM creation scripts, but that can be done in a build script fairly easily, I think.

提交回复
热议问题