This PR fixes Alembic offline mode (`--sql` flag) by ensuring data migration functions only execute in online mode. When running in offline mode, these functions now skip data operations and output informational comments to the generated SQL.
feat(api): add UUIDv7 implementation in SQL and Python (#22058)
This PR introduces UUIDv7 implementations in both Python and SQL to establish the foundation for migrating from UUIDv4 to UUIDv7 as proposed in #19754.
ID generation algorithm of existing models are not changed, and new models should use UUIDv7 for ID generation.
Close #19754.
feat(api): Adjust `WorkflowDraftVariable` and `WorkflowNodeExecutionModel` (#20746)
- Add `node_execution_id` column to `WorkflowDraftVariable`, allowing efficient implementation of
the "Reset to last run value" feature.
- Add additional index for `WorkflowNodeExecutionModel` to improve the performance of last run lookup.
Closes #20745.
feat(api): Introduce `WorkflowDraftVariable` Model (#19737)
- Introduce `WorkflowDraftVariable` model and the corresponding migration.
- Implement `EnumText`, a custom column type for SQLAlchemy designed
to work seamlessly with enumeration classes based on `StrEnum`.
Alembic's offline mode generates SQL from SQLAlchemy migration operations,
providing developers with a clear view of database schema changes without
requiring an active database connection.
However, some migration versions (specifically bbadea11be and d7999dfa4a)
were performing database schema introspection, which fails in offline mode
since it requires an actual database connection.
This commit:
- Adds offline mode support by detecting context.is_offline_mode()
- Skips introspection steps when in offline mode
- Adds warning messages in SQL output to inform users that assumptions were made
- Prompts users to review the generated SQL for accuracy
These changes ensure migrations work consistently in both online and offline modes.
Close #19284.