Osem tabuliek, ktoré publikuje workflows:install (tag workflows-migrations, s časovou pečiatkou pri publikovaní; nikdy sa nenačítavajú automaticky). Názvy pochádzajú z workflows.tables.*. Migrácie idú len dopredu. Typy kľúčov sa určia pri migrácii — nastavte ich pred php artisan migrate:
- id a každý interný kľúčový stĺpec (*_id ukazujúci na tabuľku balíka) sa riadia primary_key_type (bigint s auto-increment alebo časovo zoradený primárny kľúč uuid / ulid).
- Morph dvojica <name>_type + <name>_id (nullable) drží model aplikácie. Jej stĺpec id sa riadi owner_key_type (owner_*), subject_key_type (subject_*) alebo key_type (publisher_*, starter_*, requester_*).
- Každý časový údaj sa ukladá v UTC (created_at, updated_at a deleted_at pri tabuľkách s mäkkým mazaním).
workflow_definitions
| Stĺpec | Typ | Poznámky |
|---|
id | key | — |
key | string(100) | Jedinečný v rámci vlastníka (wdef_key_unique nad owner_scope, key). |
name | string(200) | — |
description | text, nullable | — |
owner_type, owner_id | morph, nullable | Null = celá aplikácia. |
owner_scope | string(191) | Vlastník ako jeden reťazec (<morph class>:<key>, * pre celú aplikáciu) pre jedinečný kľúč. |
subject_key | string(100), nullable | Kľúč typu subjektu v registri (nikdy názov triedy). |
status | string(16) | DefinitionStatus. |
current_version_id | key, nullable, indexed | Publikovaná verzia, na ktorej bežia nové inštancie. |
webhook_id | string(26), nullable, unique | Id prichádzajúceho webhooku (vytvorí sa pri prvom publikovaní, dá sa obnoviť). |
timestamps, deleted_at | | Mäkké mazanie; zmazaná definícia si kľúč stále drží. |
workflow_versions
| Stĺpec | Typ | Poznámky |
|---|
definition_id | key | FK → definitions, pri mazaní restrict. |
number | unsigned int | Jedinečné v rámci definície (wver_number_unique). |
status | string(16) | VersionStatus. |
schema_version | string(32) | roundly.workflows.graph/v1 |
graph / trigger / settings | json | Celý dokument, konfigurácia uzla spúšťača, nastavenia. |
trigger_type / trigger_key | string(16) / string(191), nullable | Indexované spolu so status (wver_trigger_idx) pre vyhľadávanie pri emite a webhooku. |
actor_mode | string(16) | ActorMode. |
checksum | char(64) | Kanonický odtlačok grafu (expectedChecksum, sync, export). |
review_flags | json, nullable | Otvorené príznaky na kontrolu zo šablóny. |
published_at | datetime, nullable | Po nastavení sú graf, spúšťač, aktér, nastavenia, kontrolný súčet a publikujúci zmrazené. |
publisher_type, publisher_id | morph, nullable | Kto publikoval. |
schedule_cursor_at | datetime, nullable | Posledný spracovaný termín plánu. |
workflow_instances
| Stĺpec | Typ | Poznámky |
|---|
ulid | char(26), unique | Verejné id (resources, príkazy, idempotentné kľúče). |
definition_id / version_id | key | FK → definitions / versions; verzia sa nikdy nemení. |
owner_type, owner_id | morph, nullable | Vlastník inštancie. |
subject_key, subject_type, subject_id | string(100) / morph, nullable | Kľúč v registri a subjekt. |
trigger_type / trigger_key / trigger_payload | string / json, nullable | Ako sa spustila. |
idempotency_digest | char(64), nullable, indexed | — |
status | string(16) | InstanceStatus. |
current_node_id | string(64), nullable | — |
steps_count | unsigned int, default 0 | Počíta sa voči limits.max_steps. |
depth | unsigned tinyint, default 0 | Vnorenie cez start_workflow. |
parent_instance_id, parent_step_run_id, root_instance_id | key, nullable | Rodič (FK, pri mazaní null) a koreň. |
actor_mode, starter_type, starter_id | string(16) / morph, nullable | Aktér a používateľ, ktorý beh spustil. |
failure_code / failure_message / failed_node_id | string(64) / text / string(64), nullable | Hodnota FailureCode alebo kód hostiteľa; správa sa ukladá pre operátorov. |
started_at, ended_at | datetime, nullable | — |
lock_version | unsigned int, default 0 | Zvyšuje sa pri každej zmene stavu. |
workflow_step_runs
| Stĺpec | Typ | Poznámky |
|---|
instance_id | key | FK → instances, pri mazaní cascade. |
node_id / node_type | string(64) | — |
visit / attempt | unsigned int / unsigned smallint | Jedinečné spolu s instance_id, node_id (wstep_attempt_unique). |
status | string(16) | StepRunStatus. |
idempotency_key | string(100) | wf:{instance ulid}:{node id}:{visit} |
input / output | json, nullable | Vyhodnotená konfigurácia, ktorú handler videl (strop steps_input.max_bytes), a jeho výstup. |
resume_signal | json, nullable | Signál, ktorým bol pokus naposledy obnovený; opakovanie zlyhaného obnovenia ho prenesie. |
outcome | string(32), nullable | — |
error_code / error_message / error_retryable | string(64) / text / bool, nullable | — |
claim_token / lease_until | string(26) / datetime, nullable | Prevzatie cez compare-and-set a jeho lease (wstep_lease_idx). |
scheduled_for, dispatched_at, started_at, finished_at, probe_pushed_at | datetime, nullable | Časy; odoslaný probe, ktorý ešte nikto neprevzal, wake odošle znova. |
workflow_waits
| Stĺpec | Typ | Poznámky |
|---|
instance_id / step_run_id | key | FK, pri mazaní cascade. |
kind | string(16) | WaitKind. |
due_at | datetime, nullable | wwait_due_idx (status, due_at). |
event_key | string(191), nullable | wwait_event_idx (status, event_key). |
match / condition / payload | json, nullable | Párovanie udalosti, podmienka, doručený payload. |
outcome | string(32), nullable | Výsledok časového limitu. |
status, claim_token, claimed_at, fired_at | | WaitStatus a prevzatie. |
workflow_escalations
| Stĺpec | Typ | Poznámky |
|---|
instance_id / step_run_id | key | FK, pri mazaní cascade. |
level | unsigned smallint | 1 = prvá. |
due_at | datetime | wesc_due_idx (status, due_at). |
actions | json | — |
status, attempts | string(16) / unsigned smallint | EscalationStatus a počet pokusov. |
claim_token, claimed_at, fired_at, cancelled_at, error_code, error_message | | — |
workflow_idempotency_keys
| Stĺpec | Typ | Poznámky |
|---|
scope | string(16) | start alebo effect. |
key | char(64) | Odtlačok, nikdy pôvodný kľúč; jedinečný spolu so scope (widem_unique). |
definition_id / instance_id | key, nullable | FK (pri mazaní null / cascade). |
result | json, nullable | Výsledok once(). |
expires_at | datetime, nullable, indexed | Len kľúče spúšťačov (idempotency.ttl). |
created_at | datetime | Bez mäkkého mazania. |
workflow_dry_runs
| Stĺpec | Typ | Poznámky |
|---|
definition_id / version_id | key / key, nullable | FK (pri mazaní cascade / null). |
owner_*, subject_*, requester_* | morphs, nullable | — |
input / result | json | Vstup a DryRunResult. |
timestamps, deleted_at | | Čistí sa po prune.dry_runs_after. |
workflow_instances má aj winst_overlay_idx (version_id, status, current_node_id) pre prehľad behov, winst_rate_idx (definition_id, created_at) pre limit spustení a winst_status_idx (status, updated_at) pre kontrolu zaseknutých behov v doctor.
Doba uchovania
workflows:prune (plánujte denne) natrvalo zmaže ukončené inštancie staršie než prune.instances_after — nikdy nie tú s bežiacim dieťaťom — aj s ich krokmi, čakaniami, eskaláciami a kľúčmi efektov; vypršané kľúče spúšťačov; a záznamy skúšobných behov staršie než prune.dry_runs_after.