Add privileged field

This commit is contained in:
2021-12-13 01:35:04 +03:00
parent 107082d67c
commit d84ee796bb
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
"""empty message
Revision ID: 738a796c3f0a
Revises: 7a76c257df70
Create Date: 2021-12-13 01:34:21.957994
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '738a796c3f0a'
down_revision = '7a76c257df70'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('services', sa.Column('privileged', sa.Boolean(), server_default='f', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('services', 'privileged')
# ### end Alembic commands ###

View File

@@ -25,4 +25,5 @@ class Service(ormar.Model):
token: str = ormar.String(max_length=128, unique=True) # type: ignore token: str = ormar.String(max_length=128, unique=True) # type: ignore
user: int = ormar.BigInteger() # type: ignore user: int = ormar.BigInteger() # type: ignore
status: str = ormar.String(max_length=12, choices=list(Statuses), default=Statuses.pending) # type: ignore status: str = ormar.String(max_length=12, choices=list(Statuses), default=Statuses.pending) # type: ignore
privileged: bool = ormar.Boolean(default=False, server_default='f', nullable=False) # type: ignore
created_time = ormar.DateTime(timezone=True, default=datetime.now) created_time = ormar.DateTime(timezone=True, default=datetime.now)

View File

@@ -16,4 +16,5 @@ class ServiceDetail(BaseModel):
token: str token: str
user: str user: str
status: str status: str
privileged: bool
created_time: datetime created_time: datetime