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

Action Editor DB #1115

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion api/app/responses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ class ResponseReviewer(db.Model):
response_id = db.Column(db.Integer(), db.ForeignKey('response.id'), nullable=False)
reviewer_user_id = db.Column(db.Integer(), db.ForeignKey('app_user.id'), nullable=False)
active = db.Column(db.Boolean(), nullable=False)
is_action_editor = db.Column(db.Boolean(), nullable=False)

response = db.relationship('Response', foreign_keys=[response_id])
user = db.relationship('AppUser', foreign_keys=[reviewer_user_id])

def __init__(self, response_id, reviewer_user_id):
def __init__(self, response_id, reviewer_user_id, is_action_editor=False):
self.response_id = response_id
self.reviewer_user_id = reviewer_user_id
self.active = True
self.is_action_editor = is_action_editor

def deactivate(self):
self.active = False
Expand Down
28 changes: 28 additions & 0 deletions api/migrations/versions/731321158cb0_action_editor_column.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add Action Editor to Reviewers

Revision ID: 731321158cb0
Revises: 6a073dd1e30d
Create Date: 2023-03-31 11:42:59.535947

"""

# revision identifiers, used by Alembic.
revision = '731321158cb0'
down_revision = '6a073dd1e30d'

from alembic import op
import sqlalchemy as sa


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('response_reviewer', sa.Column('is_action_editor', sa.Boolean(), nullable=True))
op.execute("""UPDATE response_reviewer SET is_action_editor=False""")
op.alter_column('response_reviewer', 'is_action_editor', nullable=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('response_reviewer', 'is_action_editor')
# ### end Alembic commands ###