mirror of
https://github.com/sartography/spiffworkflow-backend.git
synced 2025-02-23 12:58:13 +00:00
add permission target
This commit is contained in:
parent
8efdf42318
commit
27d78bb7c5
@ -1,8 +1,8 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 838230f05aa0
|
||||
Revision ID: a5d7c26dd838
|
||||
Revises:
|
||||
Create Date: 2022-09-26 12:12:48.657804
|
||||
Create Date: 2022-10-07 15:11:50.254111
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '838230f05aa0'
|
||||
revision = 'a5d7c26dd838'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -46,6 +46,12 @@ def upgrade():
|
||||
)
|
||||
op.create_index(op.f('ix_message_model_identifier'), 'message_model', ['identifier'], unique=True)
|
||||
op.create_index(op.f('ix_message_model_name'), 'message_model', ['name'], unique=True)
|
||||
op.create_table('permission_target',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('uri', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('uri')
|
||||
)
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('username', sa.String(length=255), nullable=False),
|
||||
@ -321,6 +327,7 @@ def downgrade():
|
||||
op.drop_index(op.f('ix_message_correlation_property_identifier'), table_name='message_correlation_property')
|
||||
op.drop_table('message_correlation_property')
|
||||
op.drop_table('user')
|
||||
op.drop_table('permission_target')
|
||||
op.drop_index(op.f('ix_message_model_name'), table_name='message_model')
|
||||
op.drop_index(op.f('ix_message_model_identifier'), table_name='message_model')
|
||||
op.drop_table('message_model')
|
@ -20,6 +20,9 @@ from spiffworkflow_backend.models.message_model import MessageModel # noqa: F40
|
||||
from spiffworkflow_backend.models.message_triggerable_process_model import (
|
||||
MessageTriggerableProcessModel,
|
||||
) # noqa: F401
|
||||
from spiffworkflow_backend.models.permission_target import (
|
||||
PermissionTargetModel,
|
||||
) # noqa: F401
|
||||
from spiffworkflow_backend.models.principal import PrincipalModel # noqa: F401
|
||||
from spiffworkflow_backend.models.process_instance import (
|
||||
ProcessInstanceModel,
|
||||
@ -39,6 +42,5 @@ from spiffworkflow_backend.models.user_group_assignment import (
|
||||
) # noqa: F401
|
||||
|
||||
# from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel # noqa: F401
|
||||
# from spiffworkflow_backend.models.permission_target import PermissionTargetModel # noqa: F401
|
||||
|
||||
add_listeners()
|
||||
|
@ -1,10 +1,10 @@
|
||||
"""PermissionTarget."""
|
||||
from flask_bpmn.models.db import db
|
||||
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
|
||||
from sqlalchemy.schema import CheckConstraint
|
||||
|
||||
# process groups and models are not in the db
|
||||
# from sqlalchemy import ForeignKey # type: ignore
|
||||
|
||||
#
|
||||
# from spiffworkflow_backend.models.process_group import ProcessGroupModel
|
||||
# from spiffworkflow_backend.models.process_model import ProcessModel
|
||||
|
||||
@ -13,13 +13,14 @@ class PermissionTargetModel(SpiffworkflowBaseDBModel):
|
||||
"""PermissionTargetModel."""
|
||||
|
||||
__tablename__ = "permission_target"
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"NOT(process_group_id IS NULL AND process_model_identifier IS NULL AND process_instance_id IS NULL)"
|
||||
),
|
||||
)
|
||||
# __table_args__ = (
|
||||
# CheckConstraint(
|
||||
# "NOT(process_group_id IS NULL AND process_model_identifier IS NULL AND process_instance_id IS NULL)"
|
||||
# ),
|
||||
# )
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
uri = db.Column(db.String(255), unique=True, nullable=False)
|
||||
# process_group_id = db.Column(ForeignKey(ProcessGroupModel.id), nullable=True) # type: ignore
|
||||
# process_model_identifier = db.Column(ForeignKey(ProcessModel.id), nullable=True) # type: ignore
|
||||
# process_instance_id = db.Column(ForeignKey(ProcessInstanceModel.id), nullable=True) # type: ignore
|
||||
|
Loading…
x
Reference in New Issue
Block a user