Add cloud_id column to environment model

When an environment is created, we'll need to create something in the
CSP and keep track of the ID of the created thing.
This commit is contained in:
Patrick Smith 2019-01-04 14:42:14 -05:00
parent 5988f20dff
commit 2dba02e03c
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,28 @@
"""Add cloud_id column to environments
Revision ID: b3fa1493e0a9
Revises: 6172ac7b8b26
Create Date: 2019-01-04 14:28:59.660309
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b3fa1493e0a9'
down_revision = '6172ac7b8b26'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('environments', sa.Column('cloud_id', sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('environments', 'cloud_id')
# ### end Alembic commands ###

View File

@ -15,6 +15,8 @@ class Environment(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
project_id = Column(ForeignKey("projects.id"), nullable=False) project_id = Column(ForeignKey("projects.id"), nullable=False)
project = relationship("Project") project = relationship("Project")
cloud_id = Column(String)
@property @property
def users(self): def users(self):
return [r.user for r in self.roles] return [r.user for r in self.roles]