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 created_at and created_by columns #1002

Merged
merged 99 commits into from
Aug 3, 2023
Merged

Add created_at and created_by columns #1002

merged 99 commits into from
Aug 3, 2023

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Aug 1, 2023

Fixes issue

#928

Description of Changes

Add created_by and created_at columns to tables so that we can better audit things happening in the application.

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 stamp head
[2023-08-01 18:18:34,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 stamp_revision  -> 18f43ac4622f
$ flask db upgrade
[2023-08-01 18:18:49,052] 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 -> b429700e2dd2, add created_by and created_at columns
$ flask db downgrade
[2023-08-01 18:18:54,540] 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 b429700e2dd2 -> 18f43ac4622f, add created_by and created_at columns
$ flask db upgrade
[2023-08-01 18:19:04,407] 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 -> b429700e2dd2, add created_by and created_at columns
$ 

@michplunkett michplunkett self-assigned this Aug 1, 2023
@michplunkett michplunkett linked an issue Aug 1, 2023 that may be closed by this pull request
@michplunkett michplunkett changed the title Add created_at columns Add created_at and created_by columns Aug 1, 2023
@michplunkett michplunkett marked this pull request as ready for review August 3, 2023 17:29
@michplunkett michplunkett merged commit 6a27393 into develop Aug 3, 2023
2 checks passed
@michplunkett michplunkett deleted the add_created_at branch August 3, 2023 19:20
@sea-kelp
Copy link
Collaborator

@michplunkett I'm unable to create new incidents after this change because sub-objects like Location and LicensePlate aren't having their created_by field populated.

Also wanted to ask whether we want to implement these auditing fields as HiddenField since users are able to modify those using browser devtools

@michplunkett
Copy link
Collaborator Author

Interesting, i can address that now!

@michplunkett
Copy link
Collaborator Author

If users are able to edit those fields in dev tools, then we can just remove them from the Form. I'm doing that now.

sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 25, 2023
lucyparsons#928

Add `created_by` and `created_at` columns to tables so that we can
better audit things happening in the application.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.

<details><summary>DB migration output</summary>

```console
$ flask db stamp head
[2023-08-01 18:18:34,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 stamp_revision  -> 18f43ac4622f
$ flask db upgrade
[2023-08-01 18:18:49,052] 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 -> b429700e2dd2, add created_by and created_at columns
$ flask db downgrade
[2023-08-01 18:18:54,540] 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 b429700e2dd2 -> 18f43ac4622f, add created_by and created_at columns
$ flask db upgrade
[2023-08-01 18:19:04,407] 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 -> b429700e2dd2, add created_by and created_at columns
$
```
</details>
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 25, 2023
lucyparsons#928

Add `created_by` and `created_at` columns to tables so that we can
better audit things happening in the application.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.

<details><summary>DB migration output</summary>

```console
$ flask db stamp head
[2023-08-01 18:18:34,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 stamp_revision  -> 18f43ac4622f
$ flask db upgrade
[2023-08-01 18:18:49,052] 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 -> b429700e2dd2, add created_by and created_at columns
$ flask db downgrade
[2023-08-01 18:18:54,540] 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 b429700e2dd2 -> 18f43ac4622f, add created_by and created_at columns
$ flask db upgrade
[2023-08-01 18:19:04,407] 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 -> b429700e2dd2, add created_by and created_at columns
$
```
</details>
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Oct 9, 2023
lucyparsons#928

Add `created_by` and `created_at` columns to tables so that we can
better audit things happening in the application.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.

<details><summary>DB migration output</summary>

```console
$ flask db stamp head
[2023-08-01 18:18:34,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 stamp_revision  -> 18f43ac4622f
$ flask db upgrade
[2023-08-01 18:18:49,052] 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 -> b429700e2dd2, add created_by and created_at columns
$ flask db downgrade
[2023-08-01 18:18:54,540] 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 b429700e2dd2 -> 18f43ac4622f, add created_by and created_at columns
$ flask db upgrade
[2023-08-01 18:19:04,407] 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 -> b429700e2dd2, add created_by and created_at columns
$
```
</details>
AetherUnbound pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Nov 11, 2023
lucyparsons#928

Add `created_by` and `created_at` columns to tables so that we can
better audit things happening in the application.

 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.

<details><summary>DB migration output</summary>

```console
$ flask db stamp head
[2023-08-01 18:18:34,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 stamp_revision  -> 18f43ac4622f
$ flask db upgrade
[2023-08-01 18:18:49,052] 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 -> b429700e2dd2, add created_by and created_at columns
$ flask db downgrade
[2023-08-01 18:18:54,540] 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 b429700e2dd2 -> 18f43ac4622f, add created_by and created_at columns
$ flask db upgrade
[2023-08-01 18:19:04,407] 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 -> b429700e2dd2, add created_by and created_at columns
$
```
</details>
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.

Add created_at and created_by columns to all tables
3 participants