我需要爲需要存儲不同列的2種農民(組織和業主)創建數據庫,我還需要爲他們的信息進行版本化。consotypent vs性能數據庫設計db版本多態性
,我想出了一個DB設計是這樣的:(一致的)
Farmers
Id
FType check(FType in ('organization', 'landlord'))
Unique(Id,Ftype)
Organizations
Id
FType
Unique(Id, FType)
FK(Id, FType) Ref Farmers(Id, FType)
LandLords
Id
FType
Unique(Id, FType)
FK(Id, FType) Ref Farmers(Id, FType)
OrganisationVersions
Id
OrganisationId ref Organizations(id)
--lots of stuff specific to organisation
Startdate
Endate -- if null than this is the current version
LandLordVersions
Id
LandLordId ref LandLords(id)
--lots of stuff specific to landlord
StartDate
EndDate
第二個不那麼一致,但要少得多的表是這樣的:
Farmers
Id
FType
Organizations
Id
FarmerId ref Farmers(Id)
--stuff
StartDate
EndDate -- if null than this is the current version
LandLords
Id
FarmerId ref Farmers(Id)
--stuff
StartDate
EndDate
你會在舊版本上工作的頻率如何?這些只是歷史守護者,或者你有一些邏輯,這需要不同的舊版本? – 2010-08-16 08:55:01
@Nitin Midha是歷史飼養員,但我也需要加入他們有時候,其他一些表將直接引用版本表 – Omu 2010-08-16 09:02:33