0

We need help normalising the following database structure and we're a bit stumped.

Here's the current structure:

Templates

  id - primary
  name
  ...

Languages

  id - primary
  name
  code
  ...

Template Languages

  id - primary
  templateId - foreign to templates.id
  languageId - foreign to languages.id
  ...

Template Boxes

  id - primary
  templateId - foreign to templates.id

Translations

   id - primary
   templateLanguageId - foreign to templateLanguages.id
   templateBoxId - foreign to templateBoxes.id
   ...

The issue we have is a translations record should belong to a single template but currently it could belong to two separate ones depending on the link of the template languages record and template boxes record.

I could add templateId to translations but the structure would still not be normalised.

Any ideas?

Craig
  • 337
  • 2
  • 10
  • 1
    It's difficult without an explanation of the problem you're trying to design a database for. – Gilbert Le Blanc May 27 '21 at 12:39
  • @GilbertLeBlanc - Translations should be linked to a single template language and a single template box and those two relations should be linked to the same template. EDIT: Currently it's possible to link a translation to a box which is linked to e.g. Template A, and a language that is linked to e.g. Template B - this should never be allowed to happen – Craig May 27 '21 at 13:42
  • Please clarify via edits, not comments. – philipxy May 27 '21 at 17:47

0 Answers0