-
Notifications
You must be signed in to change notification settings - Fork 2
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
migrate all timestamp columns to timestamptz (timezone aware) #54
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe recent changes focus on improving how timestamps are handled in both JavaScript code and the database schema. A comment has been added to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- server/data/helper_party_api_key.ts (1 hunks)
- server/supabase/migrations/20240621172426_timestamptz.sql (1 hunks)
Files skipped from review due to trivial changes (2)
- server/data/helper_party_api_key.ts
- server/supabase/migrations/20240621172426_timestamptz.sql
@@ -8,6 +8,8 @@ export async function validateApiKey( | |||
key: string, | |||
): Promise<boolean> { | |||
const supabase = await createSupabaseServiceClient(); | |||
// toISOString() always and only returns UTC timestamps | |||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString | |||
const currentTimestamp = new Date().toISOString(); |
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.
you may want to refactor this later to be able to unit test the expiration
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.
could also add an already expired key to seed.sql for that test. it's a good test to add
@@ -0,0 +1,17 @@ | |||
alter table queries alter created_at type timestamptz using created_at at time zone 'utc'; |
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.
just to make sure - do we generate the timestamp on DB side for all of these columns during insert/update?
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.
yep!
this alters the db so that all columns use the timezone aware version of timestamp.
Summary by CodeRabbit
Documentation
toISOString()
for UTC timestamps.Chores
timestamptz
for timestamp fields and adjusted them to UTC time zone.