mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 16:09:35 +01:00
feat(production): Charge planen (PlanBatch) (#33)
Batch-Aggregat mit plan()-Factory, automatischer BatchNumber-Generierung (P-YYYY-MM-DD-XXX) und Validierung (Quantity > 0, bestBeforeDate > productionDate). Full Vertical Slice: Domain, Application, Infrastructure (JPA, REST, Liquibase).
This commit is contained in:
parent
d963d7fccc
commit
b06157b92c
25 changed files with 1541 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
<?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="015-create-batches-table" author="effigenix">
|
||||
<createTable tableName="batches">
|
||||
<column name="id" type="VARCHAR(36)">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
||||
</column>
|
||||
<column name="batch_number" type="VARCHAR(20)">
|
||||
<constraints nullable="false" unique="true" uniqueConstraintName="uq_batch_number"/>
|
||||
</column>
|
||||
<column name="recipe_id" type="VARCHAR(36)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="status" type="VARCHAR(20)" defaultValue="PLANNED">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="planned_quantity_amount" type="DECIMAL(19,6)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="planned_quantity_unit" type="VARCHAR(10)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="production_date" type="DATE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="best_before_date" type="DATE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="created_at" type="TIMESTAMP WITH TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated_at" type="TIMESTAMP WITH TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint
|
||||
baseTableName="batches"
|
||||
baseColumnNames="recipe_id"
|
||||
constraintName="fk_batch_recipe"
|
||||
referencedTableName="recipes"
|
||||
referencedColumnNames="id"/>
|
||||
|
||||
<createIndex tableName="batches" indexName="idx_batch_recipe_id">
|
||||
<column name="recipe_id"/>
|
||||
</createIndex>
|
||||
|
||||
<createIndex tableName="batches" indexName="idx_batch_production_date">
|
||||
<column name="production_date"/>
|
||||
</createIndex>
|
||||
|
||||
<sql>ALTER TABLE batches ADD CONSTRAINT chk_batch_status CHECK (status IN ('PLANNED', 'IN_PRODUCTION', 'COMPLETED', 'CANCELLED'));</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
@ -19,5 +19,6 @@
|
|||
<include file="db/changelog/changes/012-create-recipe-production-steps-table.xml"/>
|
||||
<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"/>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue