diff --git a/CHANGELOG.md b/CHANGELOG.md index 44bcea8ab22781daf0e3dc7e9e14104f3743a670..e1b9e5aeef66c8a9fba2fa2a3bbd0e273492b996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,4 +19,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### - Fixed several bugs when an Entity inherits from itself (#18, caosdb-server #85). ->>>>>>> dev diff --git a/procedures/entityVersioning.sql b/procedures/entityVersioning.sql index f6d4665bcf09bfdcbc00a78604f5055d4d3ebb6e..298fefad7945dd0624ab214a075dca0373649cd4 100644 --- a/procedures/entityVersioning.sql +++ b/procedures/entityVersioning.sql @@ -125,6 +125,11 @@ BEGIN END; // + +-- This implementation assumes that the distance from the head equals the +-- difference between the _iversion numbers. This will not be correct anymore, +-- as soon as branches may split and merge. Then, an tree-walk will be +-- necessary, traversing the primary parents (_pparent), will be necessary. DROP FUNCTION IF EXISTS db_2_0.get_head_relative // CREATE FUNCTION db_2_0.get_head_relative( EntityID INT UNSIGNED, @@ -157,6 +162,10 @@ BEGIN WHERE c.entity_id = EntityID AND c._ipparent is Null + -- TODO This first SELECT statement is necessary because the second one + -- does not return the root. However, this should be doable in one go with + -- a left join. + -- retrieve branches UNION SELECT c.version AS child, p.version AS parent,