I notice that the trackedentity startup TableAlteror has introduced a new sequence and modification to the period table.
executeSql( “CREATE SEQUENCE period_periodid_seq” );
executeSql( “ALTER TABLE period ALTER COLUMN periodid SET DEFAULT NEXTVAL(‘period_periodid_seq’)” );
Presumably the idea (as I see is implemented in HibernateCaseAggregationConditionStore.java) is that periods can be inserted with an sql statement without bothering about the periodid as it will get a default value from period_periodid_seq.
But in practice this doesn’t seem to be happening. In a range of production databases I have just looked at the nextvalue of the period_periodid_seq is 1 even though there are a large number of periods in the database. I am assuming they have had their ids populated from hibernate_sequence instead.
Something seems clearly not right here. If we have different code in parts of dhis2 which are using different sequence sources for periodid there will be clashes and odd errors on period creation.
Can somebody explain if I am misinterpreting?