1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 16:09:35 +01:00

refactor: OffsetDateTime-Migration, atomare Batch-Sequenznummern und Quantity.reconstitute-Overload

- LocalDateTime → OffsetDateTime (UTC) in allen Domain-Klassen, JPA Entities, DTOs und Tests
- Liquibase-Migration 017: TIMESTAMP → TIMESTAMP WITH TIME ZONE für bestehende Spalten
- Custom DateTimeProvider für Spring Data @CreatedDate-Kompatibilität mit OffsetDateTime
- Neue Sequenztabelle (016) mit JPA Entity + PESSIMISTIC_WRITE Lock statt COUNT-basierter
  Batch-Nummernvergabe (Race Condition Fix)
- Quantity.reconstitute(amount, uom) 2-Parameter-Overload für bessere Lesbarkeit
This commit is contained in:
Sebastian Frick 2026-02-20 00:40:58 +01:00
parent b06157b92c
commit b46495e1aa
64 changed files with 414 additions and 256 deletions

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="016-create-batch-number-sequences-table" author="effigenix">
<createTable tableName="batch_number_sequences">
<column name="production_date" type="DATE">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="last_sequence" type="INT" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="017-timestamps-to-timestamptz" author="effigenix">
<comment>Migrate all TIMESTAMP columns to TIMESTAMP WITH TIME ZONE for consistent timezone handling</comment>
<!-- users -->
<sql>ALTER TABLE users ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE users ALTER COLUMN last_login TYPE TIMESTAMP WITH TIME ZONE;</sql>
<!-- audit_logs -->
<sql>ALTER TABLE audit_logs ALTER COLUMN timestamp TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE audit_logs ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<!-- articles -->
<sql>ALTER TABLE articles ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE articles ALTER COLUMN updated_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<!-- suppliers -->
<sql>ALTER TABLE suppliers ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE suppliers ALTER COLUMN updated_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<!-- customers -->
<sql>ALTER TABLE customers ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE customers ALTER COLUMN updated_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<!-- recipes -->
<sql>ALTER TABLE recipes ALTER COLUMN created_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
<sql>ALTER TABLE recipes ALTER COLUMN updated_at TYPE TIMESTAMP WITH TIME ZONE;</sql>
</changeSet>
</databaseChangeLog>

View file

@ -20,5 +20,7 @@
<include file="db/changelog/changes/013-create-stock-schema.xml"/>
<include file="db/changelog/changes/014-create-stock-batches-table.xml"/>
<include file="db/changelog/changes/015-create-batches-table.xml"/>
<include file="db/changelog/changes/016-create-batch-number-sequences-table.xml"/>
<include file="db/changelog/changes/017-timestamps-to-timestamptz.xml"/>
</databaseChangeLog>