Skip to content

Conversation

@maxdml
Copy link
Collaborator

@maxdml maxdml commented Jul 24, 2025

  • Add GetWorkflowID() which takes a context and, if a DBOS one, returns the workflowID (otherwise an error)
  • Stop exporting some stuff
  • operation -> step rename
  • add missing dbos_test.go file
  • perform DBOS migrations in an isolated schema migration table

@maxdml maxdml marked this pull request as draft July 24, 2025 04:34
Base automatically changed from send-get-events to main July 24, 2025 16:01
Comment on lines +782 to +790
// GetWorkflowID retrieves the workflow ID from the context if called within a DBOS workflow
func GetWorkflowID(ctx context.Context) (string, error) {
wfState, ok := ctx.Value(workflowStateKey).(*workflowState)
if !ok || wfState == nil {
return "", errors.New("not within a DBOS workflow context")
}
return wfState.workflowID, nil
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetWorkflowID

@maxdml maxdml marked this pull request as ready for review July 24, 2025 17:15
Comment on lines +114 to +127
// Add custom migration table name to avoid conflicts with user migrations
// Parse the URL to properly determine where to add the query parameter
parsedURL, err := url.Parse(databaseURL)
if err != nil {
return newInitializationError(fmt.Sprintf("failed to parse database URL: %v", err))
}

// Check if query parameters already exist
separator := "?"
if parsedURL.RawQuery != "" {
separator = "&"
}
databaseURL += separator + "x-migrations-table=" + _DBOS_MIGRATION_TABLE

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dedicated migration table

Copy link
Member

@kraftp kraftp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! There should also be a GetStepID

@maxdml
Copy link
Collaborator Author

maxdml commented Jul 25, 2025

Looks good! There should also be a GetStepID

Ha, yes. Will add in another PR

@maxdml maxdml merged commit 8f3f20d into main Jul 25, 2025
1 of 2 checks passed
@maxdml maxdml deleted the workflow-context-getters branch July 25, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants