Data model
The persistent model: what the tables are, how they group into aggregates, which relationships are real foreign keys and which are not, and how Flyway is organised. The meaning of the stock nouns is in stock model and states; this page is about the storage. It is written for engineers.
One schema, module-owned tables
Everything lives in one PostgreSQL schema, karyo, in one database, reached through one Hibernate
persistence unit and one datasource (services/karyo-app/src/main/resources/application.yaml).
Compose initialization also creates a separate keycloak database on that server. The optional
managed-Keycloak profile uses it; external-provider mode leaves Keycloak stopped and that database
is not Karyo identity authority.
Ownership is by convention, not by permission: each module owns a table range and no other module's code touches those tables. Cross-module access goes through SPI lookups.
There are 101 distinct table names created across the migrations (100 tables plus the one
inventory_journals_default partition) and 5 views.
| Module | Tables |
|---|---|
| common (events, sequence) | outbox_events, sequence_numbers |
| inventory | stock_units, unit_loads, unit_load_types, inventory_journals (+ inventory_journals_default), inactive_products |
| product | item_data, item_data_numbers, item_units, packaging_units, item_substitutions, product_facility_policies |
| layout | areas, zones, aisles, facility_buildings, dock_doors, zone_temperature_readings, zone_distance_corrections, location_classes, storage_locations, location_types, location_clusters, location_reservations, location_allocation_entries, storage_strategies, fix_assignments, storage_areas, storage_area_clusters, storage_strategy_areas, item_data_areas, type_capacity_constraints, working_areas, working_area_clusters, warehouse_arrangements (one per Facility), warehouse_setup_runs |
| orders | asns, asn_lines, asn_ul_advices, goods_receipts, goods_receipt_lines, goods_receipt_asns, delivery_orders, delivery_order_lines, order_line_reservations, order_strategies |
| tasks | transport_orders |
| fulfillment | pick_orders, picks, shipments, shipment_orders, shipping_units, shipping_unit_lines |
| stocktaking | count_sessions, count_orders, count_lines, count_campaigns |
| work | work_groups, work_group_members, operator_positions |
| webhooks | webhook_subscription, webhook_delivery, webhook_fanout_cursor |
| reporting | report_definitions, plus 5 views |
| monitors | monitor_config, alerts, alert_deliveries |
| auth | company, business_units, facilities, system_properties, auth_event_cursor, home_layouts, permission_actions, permission_action_nodes, permission_profiles, permission_profile_actions, access_grants, access_provisioning_operations, principals, principal_compatibility_roles, identity_providers, identity_issuer_aliases, external_identities, identity_change_log, identity_migration_runs, setup_principal, sign_in_log |
| agent | agent_access, agent_tool_calls, agent_proposals |
| docstore | documents |
| document templates | document_templates (its migration sits in the docstore band, V1302) |
| crossdock | cross_dock_orders |
| wave | waves, consolidation_groups, consolidation_lines, sort_scans, wave_selection_rules |
| streaming | stream_batches |
The engine tables above are part of the same distribution as their modules; every build registers their migrations, so every installation creates these tables and leaves them empty until a capability acts on them. See the engine boundaries.
Five modules own no table at all and compute on demand: forecasting, slotting,
simulation, replenishment and cartonization. Forecasting, slotting and simulation read
the fulfillment picks table as their demand history; forecasting also reads the item_data name
of each forecast SKU; slotting also reads the stock units on stock, their unit loads, storage
locations and zones, and the fix_assignments rows by id (with the item_data row for an
assignment saved without a SKU), and when the Loci slotting engine is configured it sends those
facts to Loci per request and stores nothing of the answer. Replenishment reads layout and inventory and
writes transport_orders through the tasks SPI. Cartonization is a single PackoutStrategy bean
that plans boxes from the caller's pick data and persists nothing of its own.
The base classes
Four @MappedSuperclass types in libs/karyo-common/src/main/kotlin/com/karyo/common/domain/BaseEntity.kt:
BaseEntity // id (IDENTITY), version (@Version), created, modified
TenantEntity // + clientId: Business Unit master data and layered configuration
FacilityEntity // + facilityId: operational rows, no Business Unit column
FacilityConfigEntity // + immutable facilityId: configuration of one Facility
Four consequences that shape everything:
- Optimistic locking is universal. Every entity carries
@Version. Concurrent edits produce anOptimisticLockException, which several schedulers catch and treat as "someone else got there first". A REST request that loses one is answered with a 409concurrent-change. createdandmodifiedare plain assignable fields, not@CreationTimestampor@UpdateTimestamp. That is what makes the demo generator's backdating possible: it simply assigns a past instant.TenantEntity.clientIddefaults to0, the Company key in layered configuration. Business Unit master data must explicitly name a positive unit. There is no SYS row. ATenantContexton a scheduler thread is unprimed; reading itsclientIdthrows instead of answering 0.- There is no Hibernate tenant filter. Application code applies
readFacilityScope()andwriteFacilityScope()or explicit Facility predicates. A reader that needs the Business Unit derives it throughOrganizationLookupfrom the row's Facility. Queries need their scope predicate, because nothing beneath them adds it - see what actually enforces isolation.
Client extends BaseEntity, not TenantEntity, because it stores the Business Unit itself in business_units.
BusinessUnit is a type alias to that same entity. The singleton Company maps the same identity,
version, and timestamp fields directly so its assigned id can be fixed at 1 instead of generated.
The core entity relationships
The stock-and-place cluster, which is what most of the system is about:
Figure 1. The stock-and-place cluster: the real foreign keys, and the id-only links across modules.
Derived from the relationships below and the migrations under services/*/src/main/resources/db/migration; source
docs/diagrams/11-stock-and-place-cluster.mmd.
And the order-to-shipment chain:
Figure 2. The order-to-shipment chain, with the wave engine's two nullable id-only links.
Derived from the relationships below and the migrations under services/*/src/main/resources/db/migration; source
docs/diagrams/12-order-to-shipment-chain.mmd.
Two nullability rules are load-bearing, and both exist for the wave engine:
pick_orders.delivery_order_idis null for a batch pick order. A cross-order batch pick belongs to a wave, not to one order, and it carrieswave_idandbatch_zoneinstead. It follows the same shape as anEXTINGUISHpick, which also has no backing order (fulfillment V610).shipments.delivery_order_idis nullable (V612). A group shipment covers several orders and names them through theshipment_ordersjoin table.ShippingUnitLinecarriesdelivery_order_idanddelivery_order_line_idso each carton line still knows whose it is.
operator_positions keeps one row per operator and Facility: the location the operator last stood at, where Karyo
learned it (CONFIRMATION or SCAN) and when (work V1616). It has no foreign key to the location
(ADR 0007) and is written only while the Facility
dispatches by position (ADR 0063).
picks.sequence stores the one-based walking position within a pick order (fulfillment V1613).
sequence is nullable: picks created before the upgrade have none and list in id order. Reads order by sequence
(nulls last), then id. The order strategy's
proximity_route (orders V1612) defaults to false and requests a proximity route only while the Facility enables
karyo.proximity.enabled; later configuration edits do not rewrite saved work
(ADR 0062).
The order strategy's pick_source_order (orders V1615) is FIFO by default or SAME_DAY_NEAREST, enforced by a CHECK
constraint. SAME_DAY_NEAREST chooses among stock of one receipt day by distance only while the Facility enables
karyo.proximity.enabled; it is independent of proximity_route
(stock selection).
And the inbound chain, from the ASN to the goods receipt:
Figure 3. The inbound chain: an ASN's lines and unit-load advice, and the goods receipt joined through goods_receipt_asns.
Derived from the relationships below and the migrations under services/*/src/main/resources/db/migration; source
docs/diagrams/13-asn-to-goods-receipt.mmd.
Aggregates
There are no explicit aggregate-root annotations; the boundaries are visible in which entity a service transacts over and where real foreign keys stop.
| Aggregate | Root | Members | Boundary |
|---|---|---|---|
| Stock | UnitLoad |
StockUnit (optional = false back-reference), nested UnitLoads |
Location and item are crossed by id only |
| Item | ItemData |
ItemDataNumber, PackagingUnit |
|
| Place | StorageLocation |
none; LocationClass, Area, Zone, Aisle, LocationType, LocationCluster are shared references |
|
| Floor | Area |
Zone (each zone in one Area), Aisle (each aisle in one zone) |
|
| Inbound expectation | Asn |
AsnLine, AsnUlAdvice |
|
| Inbound reality | GoodsReceipt |
GoodsReceiptLine; GoodsReceiptAsn joins to the expectation |
|
| Outbound demand | DeliveryOrder |
DeliveryOrderLine, OrderLineReservation |
|
| Pick work | PickOrder |
Pick |
|
| Shipment | Shipment |
ShippingUnit, ShippingUnitLine, ShipmentOrder |
|
| Move | TransportOrder |
none, a flat entity | |
| Count | CountSession |
CountOrder, CountLine; CountCampaign sits above sessions |
|
| Wave | Wave |
ConsolidationGroup, ConsolidationLine, SortScan |
The physical hierarchy
Layout V1606 adds the physical hierarchy Area > Zone > Aisle > Bay > Level > Position (ADR 0060). These are layout-local foreign keys inside one module:
| Column | Points at | Notes |
|---|---|---|
zones.area_id |
areas.id |
Required. V1606 creates one Main Area for each Facility that has zones. |
aisles.zone_id |
zones.id |
Required and never changed. An aisle name is unique in its zone. |
storage_locations.(aisle_id, zone_id) |
aisles.(id, zone_id) |
A composite key, so an aisle location always sits in its aisle's zone. |
storage_locations.area_id |
areas.id |
Only for a location without a zone (ck_storage_locations_area). |
A location in an aisle has a bay_number and may have a level_number and a position_number,
and has no floor point. A location outside aisles may have floor_along_m and floor_across_m,
both or neither. Check constraints hold both rules. areas, zones and aisles carry the
optional size overrides aisle_spacing_m, bay_width_m and level_height_m; areas and zones
also carry sequence, start_along_m and start_across_m. rack, field, section and
x_pos, y_pos, z_pos stay as they were. V1606 fills the new fields from them for every
location with a zone, a rack and grid steps from 1, which is the shape Warehouse setup stores:
one aisle for each zone and rack, the bay from the label in field, and the level and the position
inside the bay from the tokens of the name that follow the rack and the bay. A name that does not
carry them, or a value below 1, leaves the location with no place.
Layout V1608 adds the Facility default storage strategy
(ADR 0061).
storage_strategies.facility_default marks it, and the partial unique index
uq_storage_strategies_facility_default allows one for each Facility. The Facility's proximity
setting is a runtime setting, not a column.
Layout V1610 adds zone_distance_corrections, the sparse corrections to the computed walk between
two zone doors (ADR 0061).
One row holds one unordered pair for one Facility, with zone_a_id below zone_b_id. Both zones
are layout-local foreign keys on (zone id, facility_id) and the row goes with either zone.
Layout V1617 adds what the floor view cannot work out from the hierarchy
(ADR 0065). areas, zones
and aisles gain the size override rack_depth_m. zones gains enclosed and the set point range
set_point_low_c and set_point_high_c, which ck_zones_set_point keeps to both ends or neither, low
not above high, and only on an enclosed zone. facility_buildings holds at most one building for each
Facility (uq_facility_buildings_facility): length_m, depth_m and wall_height_m. dock_doors
holds one row for each door: name (unique in the Facility), direction, wall, position_m,
width_m and location_id, a location of the same module referenced by id with no foreign key. Both
new tables carry the explicit-write trigger.
Layout V1619 adds zone_temperature_readings: one row for each zone (its primary key, with a foreign key to
zones that deletes with the zone), holding the latest celsius (-100 to 100, one decimal) and recorded_at
that a sensor feed or a person reported, and the facility_id. Karyo keeps the latest value and not a
history (ADR 0067).
References that are not foreign keys
This is the rule that most surprises newcomers:
Cross-module references are ids only. No foreign key crosses a module boundary.
It preserves the option of splitting a module out again, and it is why the schema cannot enforce integrity that a monolithic schema easily could. See ADR 0007.
The important ones:
| Column | Points at | Validated by |
|---|---|---|
unit_loads.storage_location_id |
storage_locations.id |
Nothing at the database level; the moving code resolves the location first. storage_location_name is denormalised alongside. |
stock_units.item_data_id |
item_data.id |
ProductLookup at write time. item_data_number is denormalised alongside. |
delivery_orders.destination_location_id, order_strategies.default_destination_location_id |
storage_locations.id |
StorageLocationLookup via DestinationLocationResolver |
goods_receipts.dock_location_id |
storage_locations.id |
StorageLocationLookup.findReceivingDock via ReceiptDockValidator: an unlocked location of the Facility in a Location Class with the GOODS_IN usage. dock_location_name is stored from the layout. |
pick_orders.delivery_order_id |
delivery_orders.id |
DeliveryOrderLookup |
transport_orders.goods_receipt_line_id |
goods_receipt_lines.id |
The receiving event carries it |
asn_lines.cross_dock_delivery_order_id |
delivery_orders.id |
The cross-docking engine |
Master-data and configuration business_unit_id |
business_units.id |
No cross-module foreign key. The six remaining tables are item_data, item_substitutions, inactive_products, system_properties, home_layouts and document_templates. facilities.business_unit_id has an auth-local foreign key. |
Every operational facility_id |
facilities.id |
The karyo.validate_facility_write() trigger refuses a null, unknown or archived Facility and never fills the column itself (ADR 0050). No foreign key. |
Operational rows have no business_unit_id: their Facility determines their Business Unit. The inventory
journal's partitions inherit this same schema. Transport numbers are unique within a Facility;
sequence counters remain per Business Unit. Count lines are unique by count order and stock unit;
consolidation lines by group, delivery order line, lot and cart unit load.
The remaining business_unit_id integrity is advisory, reported by
GET /api/v1/business-units/consistency, which discovers every table carrying a business_unit_id by scanning
information_schema, filtered to BASE TABLE so that a view can never contribute a false
positive. The six master and configuration tables, outbox_events, alert_deliveries, webhook_delivery, facilities and principals carry the column now.
Special tables
inventory_journals is partitioned
CREATE TABLE inventory_journals (...)
PRIMARY KEY (id, created)
) PARTITION BY RANGE (created);
CREATE TABLE inventory_journals_default PARTITION OF inventory_journals DEFAULT;
The primary key is composite (id, created), because PostgreSQL requires the partition key in the
primary key. Only the default partition exists, so all rows land there.
Gap. Nothing creates time-range partitions. There is no partition-management job, migration or scheduled task. As it stands the partitioning is structural preparation, not an active retention mechanism.
Journal columns are updatable = false on the entity: a row is written once and never changed.
outbox_events is an active event log with delivery and activity readers
Domain mutation paths append events through OutboxService.publishInFacility or
OutboxService.publishForBusinessUnit
(libs/karyo-events/src/main/kotlin/com/karyo/events/outbox/OutboxService.kt): aggregate type,
aggregate id, event type, JSONB payload, tenant id, published flag.
Its live consumer is the webhook fanout relay. See events and the outbox.
system_properties overrides environment configuration by design
The runtime-settings store (auth V1202). RuntimePropertyLookup resolves in this order:
- the stored row for this key and this
clientId, - the stored client-0 row,
- the MicroProfile config value for the same key (which is where an environment variable lands),
- the key's default in the catalogue, which is its only default.
So a database row silently beats an environment variable, and that is intentional: the environment
variable is the fallback, not the authority. Forty-nine keys are catalogued in
services/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.kt,
each with a type, a group, a default, and access/exposure flags. Ten entries - identity trust, the setup
reopen marker, the agent resource URI and the five ship-from address fields - are environment-only and refuse runtime
writes. See
the runtime configuration store.
Principals own identity, grants and personal state
Auth V1208 creates Karyo-owned principals, principal_compatibility_roles, provider
registrations, exact issuer aliases and opaque-subject bindings. A provider/subject pair remains
unique even after unlinking, so an old credential cannot be reassigned. identity_change_log
records principal and binding mutations, while identity_migration_runs is the digest-bound
cutover marker required before real JWT traffic is accepted.
Auth V1218 adds setup_principal, a single-row table that remembers System, the setup principal of a
fresh installation: its principal, its fixed expiry, why it was disabled and the last server-side
reopen marker applied (ADR 0053).
principal_compatibility_roles holds legacy job-role names per principal
(services/karyo-app/src/main/resources/db/migration/auth/V1208__create_principals_and_external_identities.sql, karyo.principals, karyo.principal_compatibility_roles, karyo.identity_providers, karyo.identity_issuer_aliases, karyo.external_identities, karyo.identity_change_log, karyo.identity_migration_runs).
No migration drops it, but the application does not map or read it, and a row in it grants
nothing (ADR 0048).
Only scripts/identity_migration.py uses it: enrollment writes the roles of a reviewed manifest
entry (scripts/identity_migration.py, apply_sql), and access activation reads them
(scripts/identity_migration.py, access_preflight) and translates them through the ACTION_ROLES gate table
into the catalogue actions a reviewed grant may propose (scripts/identity_migration.py, ACTION_ROLES, validate_access_grant).
Auth V1209 re-keys personal layouts, access grants and completed provisioning operations to a
principal_id. home_layouts has one default row per business_unit_id and at most one personal row per
(business_unit_id, principal_id). Its old user_subject remains only as migration provenance and may
support an uncut-over structural state; the reviewed identity manifest must assign every personal
row before cutover.
Tree grants likewise authorize a principal UUID. access_grants.subject and
granted_by_subject remain historical provider snapshots, while the principal columns are the
stable ownership keys. The checked (node_type, node_id) pair deliberately has no polymorphic
foreign key. Only ACTIVE grants resolve; identity and tenancy
owns their request-time activation boundary.
access_provisioning_operations is idempotent disabled-first coordination state, not a password
or user store. New operations bind their HMAC-SHA-256 fingerprint and result to principal,
provider and binding ids; completed legacy operations retain their original subject-based v1
fingerprint for exact retry compatibility. The server-held HMAC key and passwords are never stored
in the table. Provider enablement happens only after the database operation reaches
GRANTS_COMMITTED.
order_strategies.extension_properties is a JSONB relief valve
Rather than a migration per new flag, newer configuration lands as keys in a JSONB column. Wave and streaming configuration live entirely there. The keys are listed in strategies and policies.
KPI projections, not tables
reporting owns three read-only SQL functions and two ordinary views, computed at query time
(services/karyo-app/src/main/resources/db/migration/reporting/). The V1009 daily functions
require an explicit Facility and its resolved time zone; the two current views have no day boundary.
| Projection | What it reports |
|---|---|
kpi_throughput_daily |
Daily throughput; see the reporting interpretation linked below |
kpi_accuracy_daily |
Count accuracy per day |
kpi_cycle_time_daily |
Order cycle time per day |
kpi_utilization_current |
Point-in-time location utilisation |
kpi_location_occupancy |
Per-location occupancy for Home's warehouse widget, plus capacity (V1006), plus rack, field, level, dimensions, Location Class usages, temperature zone, kind, lock type and held-stock count for the derived drawing (V1007) |
Their output columns are a locked contract, stated in the migration comments. V1006 and V1007
each amend kpi_location_occupancy with CREATE OR REPLACE and are explicitly append-only:
each reproduces the prior select list verbatim and only adds columns (two for V1006, twelve for
V1007). The deliberate pre-2.0 exception is V1605: it renames area_usages to
location_class_usages without retaining an alias. Values, position and type remain unchanged;
ADR 0059 records why the
formerly locked name changes. Otherwise, follow the append-only discipline for future view changes.
The reporting module's README owns KPI interpretation and migration-chain caveats. A migration's comments are not an inventory of the current schema or a guarantee that a column measures physical quantities.
Migrations
services/karyo-app/src/main/resources/application.yaml owns Flyway configuration and the exact
locations list (application.yaml, quarkus.flyway.locations). It registers every band in the table below, including the
bands for the monitors, crossdock, wave and streaming engines - registered for every
build.
Migration directories live under services/karyo-app/src/main/resources/db/migration/.
Migrations belong to the aggregator, not to the module whose tables they create - a module jar
has no Flyway location of its own. See
ADR 0005.
Version bands
One global numbering space, partitioned by module so versions never collide:
| Band | Module | Directory | Count | Range in use |
|---|---|---|---|---|
| V1-V99 | common (outbox, sequence) | common |
2 | V1-V2 |
| V1xx | inventory | inventory |
14 | V101-V114 |
| V2xx | product | product |
7 | V201-V207 |
| V3xx | layout | layout |
29 | V301-V324, plus V1605, V1606, V1608, V1610 and V1617 (see V16xx) |
| V4xx | orders | orders |
34 | V401-V434 |
| V5xx | tasks | tasks |
9 | V501-V509 |
| V6xx | fulfillment | fulfillment |
14 | V601-V614 |
| V7xx | stocktaking | stocktaking |
8 | V701-V708 |
| V8xx | work | work |
5 | V801-V804, plus V1616 (see V16xx) |
| V9xx | webhooks | webhooks |
1 | V901 |
| V10xx | reporting | reporting |
8 | V1001-V1008 |
| V11xx | monitors | monitors |
8 | V1101-V1108 |
| V12xx | auth | auth |
14 | V1201-V1213, plus the fixture-only V1201_1 |
| V13xx | crossdock and docstore | crossdock, docstore |
3 + 3 | V1300, V1303, V1305; V1301-V1302, V1304 |
| V14xx | wave | wave |
4 | V1400-V1403 |
| V15xx | streaming | streaming |
1 | V1500 |
| V16xx | agent | agent |
2 | V1600, V1603 (V1601 sits in common, V1602, V1604, V1607 and V1614 in auth, V1605, V1606, V1608, V1610 and V1617 in layout, V1612 and V1615 in orders, V1613 in fulfillment, V1616 in work) |
Note that crossdock and docstore share the V13xx band: crossdock has V1300, V1303 and V1305, docstore has V1301, V1302 and V1304. They are in different directories, so a future migration in either has to check the other before choosing a number.
Four rules and one trap
1. Forward-only. No down migrations. A mistake is corrected by a new migration, never by editing an
applied one. Editing an applied file produces a Flyway checksum mismatch, whose only fixes are
--reset-db (destroying data) or a corrective migration. The one repeatable migration is
common/R__explicit_facility_writes.sql: it names every table with a required facility_id, so adding such a
table means editing that list, and FacilityStampingTest fails until you do. Before the first release, the
Facility conversion edited the pre-release migrations in place, and development databases are rebuilt
(deploying).
2. out-of-order: true is mandatory, not optional. Because bands interleave, a new low-band
migration - say layout V319 - sorts before already-applied higher-band migrations such as orders
V431 on a long-lived database. Flyway rejects that unless out-of-order is on. Fresh databases (Dev
Services, tests) never hit it, so the failure only appears on a real deployment.
3. A new migration directory must be registered in quarkus.flyway.locations. This is the trap.
A migration in an unregistered directory silently never runs: no warning, no error, just a
missing table at runtime. Adding a module means editing that list, not just creating the folder.
4. Data migrations must be defensive. Wave V1402 widens consolidation_groups.destination_key
and backfills three-part keys best-effort, warning about what it cannot convert. When a migration
changes the meaning of stored data rather than its shape, the migration says what it could not do
rather than guessing.
Seed data in migrations
Several migrations seed rows, so a fresh deployment is usable:
business_unitshas no Company or SYS row after V1602. A fresh production installation has no Business Unit. Development and test fixture units 1 and 2 (ACME, GLOBEX) come fromV1201_1only when thefixture_organizationsFlyway placeholder ison. The sequence starts at 100.permission_profilesseeds four standard profiles (V1213): operations read, operations write, user administration and integrations.facilitiesseeds one default Facility,MAIN, for each positivebusiness_unitsrow (ids start at 1,000,000). The Company has no Facility of its own.companyseeds its fixed id 1 with neutral installation metadata (Company,COMPANY,UNSPECIFIED) independently of Business Unit rows or configuration key 0.permission_actionsandpermission_action_nodesseed the finite action catalog and its Company and Business Unit grant positions. Profiles and grants themselves are not seeded.unit_load_typesseeds default types (inventory/V105__seed_unit_load_types.sql), including the "Pick Bin" type withaggregate_stocks = TRUEthat pick containers default to.order_strategiesseeds a default strategy (orders/V405__seed_default_order_strategy.sql).item_unitsseeds base units of measure (product/V201__create_item_units.sql).
The demo reset (POST /api/v1/demo/reset) truncates operational and catalog tables but preserves
the reference seeds by leaving them out of its truncate list: item_units, unit_load_types,
order_strategies and monitor_config among them.
Working with the schema
| Task | How |
|---|---|
| Add a table | New migration in the owning module's directory, in its band. Add the entity, extending TenantEntity unless it is the tenant dimension. |
| Add a module | Create the directory and add it to quarkus.flyway.locations, in a fresh band. Add META-INF/beans.xml to the core. |
| Fix an applied migration | Never edit it. Write a new one. |
| Reference another module's row | Id column, no foreign key, validate through that module's lookup SPI on the write path |
| Reset a development database | ./scripts/deploy-server.sh --reset-db, or drop the Dev Services volume |
| Check tenant consistency | GET /api/v1/business-units/consistency |
Related
- Stock model and states - what these entities mean
- Modules and boundaries - which module owns what
- Data and persistence - the persistence configuration
- ADR 0004 - one database, one schema
Sources
services/karyo-app/src/main/resources/db/migration/- table definitions and migration bandsservices/karyo-app/src/main/resources/db/migration/inventory/V105__seed_unit_load_types.sql,orders/V405__seed_default_order_strategy.sql,product/V201__create_item_units.sqlandauth/V1201__create_clients.sql- the seed migrationsservices/karyo-app/src/main/resources/application.yaml- authoritative Flyway configurationlibs/karyo-common/src/main/kotlin/com/karyo/common/domain/BaseEntity.kt- the two base classesservices/karyo-app/src/main/resources/db/migration/inventory/V102__create_unit_loads.sql,V103__create_stock_units.sqlandV104__create_inventory_journals.sql- the missing foreign keys, theCHECKconstraints, and the journal partitioningservices/karyo-app/src/main/resources/db/migration/layout/V305__create_storage_locations.sqlservices/karyo-app/src/main/resources/db/migration/auth/V1202__create_system_properties.sql- the settings storeservices/karyo-app/src/main/resources/db/migration/auth/V1205__create_company.sql- the Company singletonservices/karyo-app/src/main/resources/db/migration/auth/V1206__create_permission_grants.sqlthroughV1209__add_principal_identity_references.sql- the grant schema, disabled-first coordination, stable principals, exact external bindings and principal-reference backfill shapeservices/karyo-app/src/main/resources/db/migration/reporting/- the views and their locked column contractservices/karyo-app/src/main/resources/db/migration/fulfillment/(V610-V612) andwave/V1402__sort_station.sql- the nullability rules and the defensive backfillservices/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.ktandservices/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/domain/model/Client.ktservices/auth-service/karyo-auth-api/src/main/kotlin/com/karyo/auth/spi/RuntimePropertyLookup.kt- the four-step resolution ladderservices/demo-service/karyo-demo/src/main/kotlin/com/karyo/demo/service/DemoDataService.kt- what the demo reset preserves- Every
@Entityclass underservices/andlibs/- the aggregate table