add approved to comment and interpretation

This commit is contained in:
SvyatoslavArtymovych 2023-05-11 15:07:22 +03:00
parent 5096886a93
commit 369452bc05
3 changed files with 42 additions and 1 deletions

View File

@ -10,9 +10,9 @@ class Comment(BaseModel):
# need to redeclare id to use it in the parent relationship # need to redeclare id to use it in the parent relationship
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.Text, unique=False, nullable=False) text = db.Column(db.Text, unique=False, nullable=False)
approved = db.Column(db.Boolean, default=False)
marked = db.Column(db.Boolean, default=False) marked = db.Column(db.Boolean, default=False)
edited = db.Column(db.Boolean, default=False) edited = db.Column(db.Boolean, default=False)
included_with_interpretation = db.Column(db.Boolean, default=False)
# Foreign keys # Foreign keys
user_id = db.Column(db.ForeignKey("users.id")) user_id = db.Column(db.ForeignKey("users.id"))

View File

@ -11,6 +11,7 @@ class Interpretation(BaseModel):
label = db.Column(db.String(256), unique=False, nullable=False) label = db.Column(db.String(256), unique=False, nullable=False)
text = db.Column(db.Text, unique=False, nullable=False) text = db.Column(db.Text, unique=False, nullable=False)
approved = db.Column(db.Boolean, default=False)
marked = db.Column(db.Boolean, default=False) marked = db.Column(db.Boolean, default=False)
created_at = db.Column(db.DateTime, default=datetime.now) created_at = db.Column(db.DateTime, default=datetime.now)

View File

@ -0,0 +1,40 @@
"""approved fields
Revision ID: 5df1fabbee7d
Revises: 1dfa1f2c208f
Create Date: 2023-05-11 15:06:42.883725
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5df1fabbee7d'
down_revision = '1dfa1f2c208f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('comments', schema=None) as batch_op:
batch_op.add_column(sa.Column('approved', sa.Boolean(), nullable=True))
batch_op.drop_column('included_with_interpretation')
with op.batch_alter_table('interpretations', schema=None) as batch_op:
batch_op.add_column(sa.Column('approved', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('interpretations', schema=None) as batch_op:
batch_op.drop_column('approved')
with op.batch_alter_table('comments', schema=None) as batch_op:
batch_op.add_column(sa.Column('included_with_interpretation', sa.BOOLEAN(), autoincrement=False, nullable=True))
batch_op.drop_column('approved')
# ### end Alembic commands ###