added dd-254 model
This commit is contained in:
parent
e260d82a97
commit
bfcee47db6
38
alembic/versions/7d9f070012ae_dd254.py
Normal file
38
alembic/versions/7d9f070012ae_dd254.py
Normal file
@ -0,0 +1,38 @@
|
||||
"""dd254
|
||||
|
||||
Revision ID: 7d9f070012ae
|
||||
Revises: b3a1a07cf30b
|
||||
Create Date: 2019-02-18 08:38:07.076612
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7d9f070012ae'
|
||||
down_revision = 'b3a1a07cf30b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('dd_254s',
|
||||
sa.Column('time_created', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('time_updated', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('certifying_official', sa.String(), nullable=True),
|
||||
sa.Column('co_title', sa.String(), nullable=True),
|
||||
sa.Column('co_address', sa.String(), nullable=True),
|
||||
sa.Column('co_phone', sa.String(), nullable=True),
|
||||
sa.Column('required_distribution', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('task_orders', sa.Column('dd_254_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_foreign_key("task_orders_dd_254s_id", 'task_orders', 'dd_254s', ['dd_254_id'], ['id'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('task_orders_dd_254s_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_column('task_orders', 'dd_254_id')
|
||||
op.drop_table('dd_254s')
|
@ -20,3 +20,4 @@ from .request_internal_comment import RequestInternalComment
|
||||
from .audit_event import AuditEvent
|
||||
from .invitation import Invitation
|
||||
from .task_order import TaskOrder
|
||||
from .dd_254 import DD254
|
||||
|
31
atst/models/dd_254.py
Normal file
31
atst/models/dd_254.py
Normal file
@ -0,0 +1,31 @@
|
||||
from sqlalchemy import Column, String
|
||||
from sqlalchemy.types import ARRAY
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from atst.models import Base, types, mixins
|
||||
|
||||
|
||||
class DD254(Base, mixins.TimestampsMixin):
|
||||
__tablename__ = "dd_254s"
|
||||
|
||||
id = types.Id()
|
||||
|
||||
certifying_official = Column(String)
|
||||
co_title = Column(String)
|
||||
co_address = Column(String)
|
||||
co_phone = Column(String)
|
||||
required_distribution = Column(ARRAY(String))
|
||||
|
||||
task_order = relationship("TaskOrder", uselist=False, backref="task_order")
|
||||
|
||||
def to_dictionary(self):
|
||||
return {
|
||||
c.name: getattr(self, c.name)
|
||||
for c in self.__table__.columns
|
||||
if c.name not in ["id"]
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return "<DD254(certifying_official='{}', task_order='{}', id='{}')>".format(
|
||||
self.certifying_official, self.task_order.id, self.id
|
||||
)
|
@ -49,6 +49,9 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
so_id = Column(ForeignKey("users.id"))
|
||||
security_officer = relationship("User", foreign_keys="TaskOrder.so_id")
|
||||
|
||||
dd_254_id = Column(ForeignKey("dd_254s.id"))
|
||||
dd_254 = relationship("DD254")
|
||||
|
||||
scope = Column(String) # Cloud Project Scope
|
||||
defense_component = Column(String) # Department of Defense Component
|
||||
app_migration = Column(String) # App Migration
|
||||
|
Loading…
x
Reference in New Issue
Block a user