具有本地化的数据库模式

时间:2014-03-17 16:01:26

标签: sql sql-server

我正在使用本地化和SQL表创建一个应用程序。

我想知道我应该使用哪种方法来创建表格。

选项1

每个文化的一个表(帖子)和另一个(Posts_Localized)。

create table dbo.Posts
(
  Id int identity not null,
  Created datetime not null
);

create table dbo.Posts_Localized
(
  Id int not null,
  [Culture] int not null 
    constraint CK_Culture check ([Culture] in ('1', '2', '3')), // EN, FR, DE
  Title nvarchar (200) not null
);

选项2

所有数据的一个表(帖子)...每个记录都有一个KEY。

版本EN,PT,FR将共享一个KEY,因为它是相同帖子的不同版本。

create table dbo.Posts
(
  Id int identity not null,
  Created datetime not null,
  [Culture] int not null 
    constraint CK_Culture check ([Culture] in ('1', '2', '3')), // EN, FR, DE
  Title nvarchar (200) not null,
  [Key] uniqueidentifier not null
);

我看到第二个的好处是因为:

  1. 联接会更少;

  2. 如果我确定列可能会从常见变为不常见,我将无需更改数据库架构......

  3. 您怎么看?

    谢谢你, 米格尔

0 个答案:

没有答案
相关问题