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

Feature/allegations table #348

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
migration generated
  • Loading branch information
sorenrehkopf committed Aug 7, 2023
commit 9e77774c505b72dbce8574d2fb3385ce92836e71
4 changes: 2 additions & 2 deletions OpenOversight/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ class Allegation(BaseModel):
case = db.Column(db.String(255), nullable=True)
source = db.Column(db.String(255), nullable=True)
# fks
incident_id = db.Column(db.Integer, db.ForeignKey('incident.id'), nullable=False)
officer_id = db.Column(db.Integer, db.ForeignKey('officer.id'), nullable= True)
incident_id = db.Column(db.Integer, db.ForeignKey('incidents.id'), nullable=False)
officer_id = db.Column(db.Integer, db.ForeignKey('officers.id'), nullable= True)



Expand Down
54 changes: 54 additions & 0 deletions OpenOversight/migrations/versions/171ee9412815_add_allegations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""add-allegations

Revision ID: 171ee9412815
Revises: 8fc4d110de2c
Create Date: 2023-08-05 00:14:32.513077

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '171ee9412815'
down_revision = '8fc4d110de2c'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('allegations',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('date_created', sa.DateTime(), nullable=True),
sa.Column('date_updated', sa.DateTime(), nullable=True),
sa.Column('allegation', sa.String(length=255), nullable=True),
sa.Column('disposition', sa.String(length=255), nullable=True),
sa.Column('discipline', sa.String(length=255), nullable=True),
sa.Column('finding', sa.String(length=255), nullable=True),
sa.Column('officer_name', sa.String(length=255), nullable=True),
sa.Column('star_no', sa.String(length=120), nullable=True),
sa.Column('incident_type', sa.String(length=255), nullable=True),
sa.Column('case', sa.String(length=255), nullable=True),
sa.Column('source', sa.String(length=255), nullable=True),
sa.Column('incident_id', sa.Integer(), nullable=False),
sa.Column('officer_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['incident_id'], ['incidents.id'], ),
sa.ForeignKeyConstraint(['officer_id'], ['officers.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('allegations', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_allegations_date_updated'), ['date_updated'], unique=False)
batch_op.create_index(batch_op.f('ix_allegations_star_no'), ['star_no'], unique=False)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('allegations', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_allegations_star_no'))
batch_op.drop_index(batch_op.f('ix_allegations_date_updated'))

op.drop_table('allegations')
# ### end Alembic commands ###