add rols to user
This commit is contained in:
parent
47e918dc07
commit
3c23c8ce09
|
@ -11,7 +11,7 @@ from sqlalchemy.dialects import postgresql
|
|||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5169765e2653'
|
||||
down_revision = '2f2ef041483a'
|
||||
down_revision = 'a8a86dbd5f51'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
"""add rols to user
|
||||
|
||||
Revision ID: a8a86dbd5f51
|
||||
Revises: 5169765e2653
|
||||
Create Date: 2023-06-14 15:04:03.478157
|
||||
|
||||
"""
|
||||
import citext
|
||||
import sqlalchemy as sa
|
||||
from alembic import context, op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a8a86dbd5f51'
|
||||
down_revision = '2f2ef041483a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def get_inv():
|
||||
INV = context.get_x_argument(as_dictionary=True).get('inventory')
|
||||
if not INV:
|
||||
raise ValueError("Inventory value is not specified")
|
||||
return INV
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
'user',
|
||||
sa.Column('rols_dlt', type_=citext.CIText(), nullable=True),
|
||||
schema='common',
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('user', 'rols_dlt', schema='common')
|
|
@ -33,6 +33,7 @@ class User(UserMixin, Thing):
|
|||
active = Column(Boolean, default=True, nullable=False)
|
||||
phantom = Column(Boolean, default=False, nullable=False)
|
||||
api_keys_dlt = Column(CIText(), nullable=True)
|
||||
rols_dlt = Column(CIText(), nullable=True)
|
||||
inventories = db.relationship(
|
||||
Inventory,
|
||||
backref=db.backref('users', lazy=True, collection_class=set),
|
||||
|
|
Reference in New Issue