[英]Using core/model database with small changes on different installations for customization without duplicating code
As an example core database looks like this:例如,核心数据库如下所示:
Person - Id, FirstName, LastName
Address - Id, Street, ZipCode
This model is used on the majority of the installations but for a couple of installations I want to add customized columns, let's say the column State
to Address
for Customer X and BirthDate
to Person
for Customer Y.此模型用于大多数安装,但对于一些安装,我想添加自定义列,假设列
State
to Address
for Customer X 和BirthDate
to Person
for Customer Y。
Now, I don't want to add these columns to the core database because the State
column is only used by our US customers and the BirthDate
is only used by our European customers were BirthDate
is obligatory ( NOT NULL
) and would therefore need a dummy value for all the other customers.现在,我不想将这些列添加到核心数据库中,因为
State
列仅由我们的美国客户使用,而BirthDate
仅由我们的欧洲客户使用,因为BirthDate
是强制性的( NOT NULL
),因此需要一个虚拟对所有其他客户的价值。
I was checking in GitHub about having several branches - Core
and US-Customer
- but that would mean that the whole Core
solution would be copied over to the US-Customer
branch but when the Core
branch is changed it would not update the US-Customer
branch ie having to maintain basically two repositories.我在 GitHub 上检查了关于有几个分支 -
Core
和US-Customer
- 但这意味着整个Core
解决方案将被复制到US-Customer
分支,但是当Core
分支发生更改时,它不会更新US-Customer
分支即必须维护基本上两个存储库。
Is it possible to have this sort of customization either in SQL Data Tools
or in GitHub
were the customized solutions (eg US-Customer
) would only have the absolutely necessary changes and without SQL Data Tools
throwing errors in Visual Studio
about missing tables or any other error?是否有可能在
SQL Data Tools
或GitHub
进行这种自定义,如果自定义解决方案(例如US-Customer
)只会进行绝对必要的更改,并且SQL Data Tools
不会在Visual Studio
抛出有关丢失表或任何其他错误错误?
Example:例子:
Core
branch Core
分支
Person - Id, FirstName, LastName
Address - Id, Street, ZipCode
US-Customer
branch US-Customer
分公司
ALTER TABLE Address ADD State CHAR(2) NOT NULL
EU-Customer
branch EU-Customer
分公司
ALTER TABLE Person ADD BirthDate DATE NOT NULL
There is no very easy way of implementing so.没有很容易实现的方法。 If you wish to do that completely in SSDT way, then you need to create several projects:
如果您希望以 SSDT 方式完全做到这一点,那么您需要创建几个项目:
ProjectCore
as The same database
; ProjectCore
引用为The same database
;ProjectCore
as The same database
. ProjectCore
引用为The same database
。 Both ProjectUS
and ProjectEU
will have their own publish profiles. ProjectUS
和ProjectEU
都有自己的发布配置文件。 You'll have put full definition of different objects there, not just ALTER statements.您将在那里放置不同对象的完整定义,而不仅仅是 ALTER 语句。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.