Add Environment.creator_role relation
This commit is contained in:
parent
4405ed91d5
commit
e65c1d69b6
@ -0,0 +1,30 @@
|
|||||||
|
"""add Environment creator_role
|
||||||
|
|
||||||
|
Revision ID: cfab6c8243cb
|
||||||
|
Revises: 502e79c55d2d
|
||||||
|
Create Date: 2019-09-10 11:21:43.252592
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'cfab6c8243cb' # pragma: allowlist secret
|
||||||
|
down_revision = '502e79c55d2d'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('environments', sa.Column('creator_role_id', postgresql.UUID(as_uuid=True), nullable=False))
|
||||||
|
op.create_foreign_key("fk_application_roles_id", 'environments', 'application_roles', ['creator_role_id'], ['id'])
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint("fk_application_roles_id", 'environments', type_='foreignkey')
|
||||||
|
op.drop_column('environments', 'creator_role_id')
|
||||||
|
# ### end Alembic commands ###
|
@ -18,6 +18,9 @@ class Environment(
|
|||||||
application_id = Column(ForeignKey("applications.id"), nullable=False)
|
application_id = Column(ForeignKey("applications.id"), nullable=False)
|
||||||
application = relationship("Application")
|
application = relationship("Application")
|
||||||
|
|
||||||
|
creator_role_id = Column(ForeignKey("application_roles.id"), nullable=False)
|
||||||
|
creator = relationship("ApplicationRole")
|
||||||
|
|
||||||
cloud_id = Column(String)
|
cloud_id = Column(String)
|
||||||
root_user_info = Column(JSONB)
|
root_user_info = Column(JSONB)
|
||||||
baseline_info = Column(JSONB)
|
baseline_info = Column(JSONB)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user