Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database structure for versioning and multiple languages

How can I solve the issue of content existing in multiple versions and multiple languages?

My current structure:

Each content can only have one active version in each language, and that's how I'm curious on how to best solve.

Right now I have a column of the contentversions table, which means for each change of active version I have to run a update and set active=false on all version and then a update to set active=true for the piece of content in question.

like image 582
phobia Avatar asked Jun 02 '26 17:06

phobia


1 Answers

You could use a table activeversion with the same structure as content_contentversion_languages, but with a unique key on (content_id, language_id) and a single foreign key on all columns, referencing content_contentversion_languages. Marking a new version as active requires just a single INSERT or UPDATE to this table.

like image 168
Marcelo Cantos Avatar answered Jun 04 '26 11:06

Marcelo Cantos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!