forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show department last updated dates (#214)
* Add Department last updated dates * Refactor repetitive test code * Show date_updated for officers, incidents, and assignments * Update cache TTL to 12 hours
- Loading branch information
Showing
6 changed files
with
172 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"""Add date_created and date_updated to assignments, incidents, officers tables. | ||
Revision ID: 8fc4d110de2c | ||
Revises: cd39b33b5360 | ||
Create Date: 2022-10-12 05:26:07.671962 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "8fc4d110de2c" | ||
down_revision = "cd39b33b5360" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"assignments", sa.Column("date_created", sa.DateTime(), nullable=True) | ||
) | ||
op.add_column( | ||
"assignments", sa.Column("date_updated", sa.DateTime(), nullable=True) | ||
) | ||
op.create_index( | ||
op.f("ix_assignments_date_updated"), | ||
"assignments", | ||
["date_updated"], | ||
unique=False, | ||
) | ||
|
||
op.add_column("incidents", sa.Column("date_created", sa.DateTime(), nullable=True)) | ||
op.add_column("incidents", sa.Column("date_updated", sa.DateTime(), nullable=True)) | ||
op.create_index( | ||
op.f("ix_incidents_date_updated"), "incidents", ["date_updated"], unique=False | ||
) | ||
|
||
op.add_column("officers", sa.Column("date_created", sa.DateTime(), nullable=True)) | ||
op.add_column("officers", sa.Column("date_updated", sa.DateTime(), nullable=True)) | ||
op.create_index( | ||
op.f("ix_officers_date_updated"), "officers", ["date_updated"], unique=False | ||
) | ||
|
||
op.execute( | ||
""" | ||
update officers | ||
set date_created='2021-12-28', | ||
date_updated='2021-12-28'; | ||
""" | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f("ix_officers_date_updated"), table_name="officers") | ||
op.drop_column("officers", "date_updated") | ||
op.drop_column("officers", "date_created") | ||
|
||
op.drop_index(op.f("ix_incidents_date_updated"), table_name="incidents") | ||
op.drop_column("incidents", "date_updated") | ||
op.drop_column("incidents", "date_created") | ||
|
||
op.drop_index(op.f("ix_assignments_date_updated"), table_name="assignments") | ||
op.drop_column("assignments", "date_updated") | ||
op.drop_column("assignments", "date_created") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Authlib==0.15.5 | ||
boto3==1.24.21 | ||
cachetools==5.2.0 | ||
email-validator==1.2.1 | ||
Fabric3==1.14.post1 | ||
Flask==2.2.2 | ||
|