Skip to content
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: ignore last_auth_at to update modified_at on users table #8091

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

keita-determined
Copy link
Contributor

Description

fix for https://github.com/determined-ai/release-party-issues/issues/786#issuecomment-1749503941

When last_auth_at is updated, trigger should ignore the change

Test Plan

  • Check if modified_at column is updated only when one or more of password_hash, admin, active, display_name, remote column(s) are changed.

Commentary (optional)

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

@cla-bot cla-bot bot added the cla-signed label Oct 6, 2023
@netlify
Copy link

netlify bot commented Oct 6, 2023

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit e6e56d0
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65204b94f1e7b80008aa2e8e
😎 Deploy Preview https://deploy-preview-8091--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@keita-determined keita-determined marked this pull request as ready for review October 6, 2023 18:02
@keita-determined keita-determined requested a review from a team as a code owner October 6, 2023 18:02
DROP TRIGGER IF EXISTS autoupdate_users_modified_at ON users;

CREATE TRIGGER autoupdate_users_modified_at
BEFORE INSERT OR UPDATE OF password_hash, admin, active, display_name, remote ON public.users
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to list columns. Are there better way to trigger function? I couldn't find except or ignore specific column option in postgres trigger

Copy link
Member

Choose a reason for hiding this comment

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

yeah, it'd be great if we could do it the other way around. As is if we add a column it would be easy to miss to add it here.

Copy link
Member

@hamidzr hamidzr left a comment

Choose a reason for hiding this comment

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

re the down side of the migration: the added migration is reversible but reversing it means putting the bug back in. do we want to add it? cc @stoksc

the changes work great
2023-10-06_11-19

DROP TRIGGER IF EXISTS autoupdate_users_modified_at ON users;

CREATE TRIGGER autoupdate_users_modified_at
BEFORE INSERT OR UPDATE OF password_hash, admin, active, display_name, remote ON public.users
Copy link
Member

Choose a reason for hiding this comment

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

yeah, it'd be great if we could do it the other way around. As is if we add a column it would be easy to miss to add it here.

@keita-determined keita-determined added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Oct 6, 2023
@stoksc
Copy link
Contributor

stoksc commented Oct 6, 2023

re the down side of the migration: the added migration is reversible but reversing it means putting the bug back in. do we want to add it?

my stance on this has always been no. but i could see an argument you would want to, just incase the bug fix is worse than the bug, and you need to revert it.

@stoksc
Copy link
Contributor

stoksc commented Oct 6, 2023

either way is fine, tbh, given the frequency at which folks use down migrations.

@keita-determined
Copy link
Contributor Author

OK. I'll go with the current state then

@keita-determined keita-determined merged commit 5483d12 into main Oct 6, 2023
75 of 89 checks passed
@keita-determined keita-determined deleted the fix/update-modified-at branch October 6, 2023 19:28
dai-release bot pushed a commit that referenced this pull request Oct 6, 2023
@dannysauer dannysauer added this to the 0.26.2 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed to-cherry-pick Pull requests that need to be cherry-picked into the current release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants