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

Add occurred_at column #992

Closed
wants to merge 69 commits into from
Closed

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Jul 27, 2023

Fixes issue

#980

Description of Changes

When both the time and date fields are filled in, we migrate them to the occurred_at column which is stored in UTC.

Screenshots

Before migration:
Screenshot 2023-07-27 at 3 01 41 PM

After initial upgrade:
Screenshot 2023-07-27 at 3 20 29 PM

After downgrade:
Screenshot 2023-07-27 at 3 36 43 PM

Final upgrade:
Screenshot 2023-07-27 at 3 37 02 PM

Incident listing:
Screenshot 2023-07-27 at 3 51 41 PM

Tests and linting

  • This branch is up-to-date with the develop branch.
  • pytest passes on my local development environment.
  • pre-commit passes on my local development environment.
DB Migration Output
$ flask db upgrade
[2023-07-27 20:20:06,782] INFO in __init__: OpenOversight startup
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 18f43ac4622f -> 9fa948bcea25, change incident date and time to timestamptz
$ flask db downgrade
[2023-07-27 20:36:20,895] INFO in __init__: OpenOversight startup
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running downgrade 9fa948bcea25 -> 18f43ac4622f, change incident date and time to timestamptz
$ flask db upgrade
[2023-07-27 20:36:49,910] INFO in __init__: OpenOversight startup
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 18f43ac4622f -> 9fa948bcea25, change incident date and time to timestamptz
$ 

@michplunkett michplunkett self-assigned this Jul 27, 2023
@michplunkett
Copy link
Collaborator Author

I think I had a much simpler understanding of this and was thinking of this as if we were handing the backend a UTC timestamp. I am modifying this PR a good amount. I'll reach out when it's good.

@michplunkett michplunkett changed the title Change incidents time and date columns to occurred_at Remove incidents time and add occurred_at column Aug 7, 2023
@michplunkett
Copy link
Collaborator Author

I'm gonna knock this one out on Monday when my mind is a little clearer.

@michplunkett michplunkett changed the title Remove incidents time and add occurred_at column Add occurred_at column Aug 16, 2023
@michplunkett
Copy link
Collaborator Author

I'm gonna restart this feature in the following PR: #1024

@michplunkett michplunkett deleted the incidents_to_timestamptz branch August 16, 2023 21:38
@michplunkett michplunkett linked an issue Sep 10, 2023 that may be closed by this pull request
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.

Convert time and date to timestamptz in incidents table
2 participants