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 allegations table #1131

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft

Add allegations table #1131

wants to merge 16 commits into from

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Oct 23, 2024

Fixes issue

#983
This PR is the first step for the ticket.

Description of Changes

Adding allegations table.

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.

@michplunkett michplunkett self-assigned this Oct 23, 2024
@michplunkett michplunkett linked an issue Oct 23, 2024 that may be closed by this pull request
@@ -705,6 +705,28 @@ class Incident(BaseModel, TrackUpdates):
)


class Allegation(BaseModel, TrackUpdates):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason, I cannot get alembic to generate a migration for this table addition. Is there anything that looks out of place, @sea-kelp?

Copy link
Collaborator

@sea-kelp sea-kelp Oct 25, 2024

Choose a reason for hiding this comment

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

I tried a number of things with the LPL OO alembic but couldn't get it to generate the revision. I was however able to cherry pick the commits (613489b..f2977e4) into our OpenOversight repo and generate the revision there. I'm wondering if there's maybe a change that we haven't ported over yet that's causing the issue?
OrcaCollective@cadea71

Obviously, our models might be slightly different from yours so I wouldn't recommend directly using this generated migration

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I remember seeing some comments that each individual models needs to be imported into Alembic's env.py file. I'll take a look at the Orca one and see what the differences are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's super hacky, but I added the table without it creating a migration and then removed the table and it created a migration. I'm just going to reverse the code on upgrade and downgrade, and take that result. I'm not super happy with how it ended up working, but I'll take it at this point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I downgrade and then upgrade the flask db command, it will error since the table will already be created when the application starts out.

I then continually used the flask db downgrade command and we get errors for other downgrades as well. I think this means we are consistent, but there are certainly some difficulties between the ORM and flask to maybe look into at some point.

Copy link
Collaborator

@sea-kelp sea-kelp left a comment

Choose a reason for hiding this comment

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

At a higher-level, I think we were discussing having multiple incident-types (lawsuits, internal investigations), each of which would have different types of additional fields.

I was thinking that allegations would belong to an internal investigation-type incident but wouldn't really apply to lawsuits, though I could see an argument for lawsuit causes of action as allegations.

@@ -705,6 +705,28 @@ class Incident(BaseModel, TrackUpdates):
)


class Allegation(BaseModel, TrackUpdates):
Copy link
Collaborator

@sea-kelp sea-kelp Oct 25, 2024

Choose a reason for hiding this comment

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

I tried a number of things with the LPL OO alembic but couldn't get it to generate the revision. I was however able to cherry pick the commits (613489b..f2977e4) into our OpenOversight repo and generate the revision there. I'm wondering if there's maybe a change that we haven't ported over yet that's causing the issue?
OrcaCollective@cadea71

Obviously, our models might be slightly different from yours so I wouldn't recommend directly using this generated migration

@michplunkett
Copy link
Collaborator Author

Would you prefer to have a quick video conversation about this at some point, @sea-kelp?

@michplunkett michplunkett marked this pull request as draft January 6, 2025 16:47
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.

2 participants