-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: The default updated_at when a workflow is created #11709
Conversation
de70b50
to
6f3505f
Compare
361b41a
to
49934eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest difference is the use of server_default instead of default to avoid updated_at becoming the server startup time.I think func.current_timestamp() is better than db.text(‘CURRENT_TIMESTAMP(0)’) for cross-database auto-adaptation.
So I replaced both created_at and updated_at
Add |
Hello @jiangbo721. #11838 has been merged, can you sync your code with the main branch and generate a new migration for this PR? The migration file can be generated by running |
282ea0b
to
f21e8bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes in schema detected.
f21e8bd
to
8973643
Compare
…e service was started. The adjusted default updated_at is the current time.
8973643
to
a73f28e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
after this PR [SQL: INSERT INTO workflows (tenant_id, app_id, type, version, graph, features, created_by, updated_by, environment_variables, conversation_variables) VALUES (%(tenant_id)s::UUID, %(app_id)s::UUID, %(type)s, %(version)s, %(graph)s, %(features)s, %(created_by)s::UUID, %(updated_by)s::UUID, %(environment_variables)s, %(conversation_variables)s) RETURNING workflows.id, workflows.created_at, workflows.updated_at] |
Temporarily removed |
I think the reason why this is going wrong is mainly due to data. Because nullable=False was not set before this commit e61752b, resulting in a potentially empty database.
|
In the database, the |
both empty and not empty tested we need a default here |
Summary
fix: The default updated_at when a workflow is created is the time the service was started.
The adjusted default updated_at is the current time.
Tip
Close issue syntax:
Fixes #<issue number>
orResolves #<issue number>
, see documentation for more details.Screenshots
Checklist
Important
Please review the checklist below before submitting your pull request.
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint gods