Re: Database design?
| От | David Link |
|---|---|
| Тема | Re: Database design? |
| Дата | |
| Msg-id | 3BD583CA.10C085C9@soundscan.com обсуждение исходный текст |
| Ответ на | Database design? ("Johnny Jørgensen" <johnny@halfahead.dk>) |
| Список | pgsql-general |
One nice way to implement a multi-language datamodel is with Database
Views.
First you create a language table 'my_table_lang' for each significant
table, called 'my_table_base'. And you create a view called 'my_table'.
The view joins those tables with the correct language filter. The
Application generally only looks at the views and not the _lang or _base
tables.
This language table, x_lang will have a column for every language
specific column, needed in the x_base table, like names and
descriptions. It will also have a language id column. And of course a
foreign key reference to the x_base table.
create view x
select
b.type, b.size, b.publisher,
l.name, l,category
from
x_base b,
x_lang l
where
l.key = b.langkey and
l.langid = 'FR' -- "French" This would be set dynamically
-- from the environment
David
;
В списке pgsql-general по дате отправления: