MySQL database design to store geospatial data with internationalization and history support

167 views Asked by At

I'm working on a a database schema to store geospatial datas, I need to support internationalization of the strings like point's name and description, and to support the logging of all the modifications.

This is my current schema :

points
---------------
rev_id (int autoincrement)
rev_from (date)
rev_to (date)
rev_operation (insert/update/delete)
rev_user (user who has made the modification)
point_id (int)
point_geom (geometry)
point_name_en
point_desc_en
point_name_fr
point_desc_fr

It works fine, but I must update the design each time I add a new language, and, in the case I update one translation I must copy an entire row... this leads to data duplication. So to avoid that I want to put the localized strings in another table :

points
---------------
rev_id (int autoincrement)
rev_from (date)
rev_to (date)
rev_operation (insert/update/delete)
rev_user (user who has made the modification)
point_id (int)
point_geom (geometry)

points_text
---------------
point_id (int)
lang_code (en/fr/es/it etc...)
point_name
point_desc

It works, but I can't track the modifications of translations.

What's the best way to design a database which store objects with their properties's translations and the history of the properties' modifications.

1

There are 1 answers

3
andrew cooke On BEST ANSWER

why not add rev_ fields to points_text (which i think has errors - see my comments on the question)?

you need to separate the two concepts: inserting points and inserting texts. both can have revisions. sometime both may occur together.

if you want you could then move that revision data out into a separate table and reference it from both the points tables. that would let you share the same entry when both are modified together.