Conversation
|
Related Documentation 1 document(s) may need updating based on files changed in this PR: DBOS Python System Database SchemaView Suggested Changes@@ -238,7 +238,7 @@
### PostgreSQL Migrations
-13 migrations are defined for PostgreSQL via `get_dbos_migrations()`:
+14 migrations are defined for PostgreSQL via `get_dbos_migrations()`:
1. [Initial schema creation](https://github.com/dbos-inc/dbos-transact-py/blob/12049d833dddbcaaea18d921149e2c33aad37ecf/dbos/_migration.py#L84-L208) - Creates all core tables, indexes, and optional LISTEN/NOTIFY triggers
2. [Add `queue_partition_key` column](https://github.com/dbos-inc/dbos-transact-py/blob/12049d833dddbcaaea18d921149e2c33aad37ecf/dbos/_migration.py#L211-L214)
@@ -253,10 +253,41 @@
11. [Add `serialization` columns to all tables](https://github.com/dbos-inc/dbos-transact-py/blob/12049d833dddbcaaea18d921149e2c33aad37ecf/dbos/_migration.py#L295-L303)
12. Add `consumed` column and `idx_notifications_unconsumed` index to notifications table
13. Create `application_versions` table with `version_id`, `version_name`, `version_timestamp`, and `created_at` columns
+14. Create PostgreSQL stored functions for SQL-based workflow operations:
+ - **`enqueue_workflow`** - Direct SQL-based workflow enqueueing with the following parameters:
+ - `workflow_name` (TEXT, required) - The name of the workflow to enqueue
+ - `queue_name` (TEXT, required) - The queue name for the workflow
+ - `positional_args` (JSON[], optional, default empty array) - Positional arguments for the workflow
+ - `named_args` (JSON, optional, default empty object) - Named arguments for the workflow
+ - `class_name` (TEXT, optional) - The class name if using class-based workflows
+ - `config_name` (TEXT, optional) - Configuration name for the workflow
+ - `workflow_id` (TEXT, optional) - Custom workflow ID (auto-generated if not provided)
+ - `app_version` (TEXT, optional) - Application version string
+ - `timeout_ms` (BIGINT, optional) - Timeout in milliseconds
+ - `deadline_epoch_ms` (BIGINT, optional) - Absolute deadline timestamp
+ - `deduplication_id` (TEXT, optional) - ID for deduplication within a queue
+ - `priority` (INTEGER, optional, default 0) - Priority for queue ordering
+ - `queue_partition_key` (TEXT, optional) - Partition key for queue distribution
+
+ Returns: `workflow_id` (TEXT) - The UUID of the enqueued workflow
+
+ The function inserts workflows with 'ENQUEUED' status, validates parameters, handles deduplication, and ensures workflow metadata consistency on conflicts.
+
+ - **`send_message`** - Direct SQL-based message sending to workflows:
+ - `destination_id` (TEXT, required) - The workflow UUID to send the message to
+ - `message` (JSON, required) - The message payload
+ - `topic` (TEXT, optional, default '__null__topic__') - Message topic for filtering
+ - `message_id` (TEXT, optional, auto-generated) - Unique message identifier
+
+ Returns: VOID
+
+ The function inserts notifications into the notifications table and handles deduplication via message_id.
### SQLite Migrations
-13 migrations are defined for SQLite (no migration 10), parallel to PostgreSQL with SQLite-specific syntax adaptations. SQLite version [does not include the `event_dispatch_kv` table](https://github.com/dbos-inc/dbos-transact-py/blob/12049d833dddbcaaea18d921149e2c33aad37ecf/dbos/_migration.py#L166-L174). Migration 13 creates the `application_versions` table with the same columns as PostgreSQL.
+13 migrations are defined for SQLite (no migration 10 or 14), parallel to PostgreSQL with SQLite-specific syntax adaptations. SQLite version [does not include the `event_dispatch_kv` table](https://github.com/dbos-inc/dbos-transact-py/blob/12049d833dddbcaaea18d921149e2c33aad37ecf/dbos/_migration.py#L166-L174). Migration 13 creates the `application_versions` table with the same columns as PostgreSQL.
+
+**Note:** SQLite does not have an equivalent for PostgreSQL migration 14 (stored functions `enqueue_workflow` and `send_message`), as these are PostgreSQL-specific features.
### Limitations
Note: You must be authenticated to accept/decline updates. |
kraftp
reviewed
Mar 4, 2026
Member
kraftp
left a comment
There was a problem hiding this comment.
We'll merge this after this week's release to give more time for testing
kraftp
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.