Merge pull request #950 from dod-ccpo/squash-migrations2
Squash the migrations into one reset.
This commit is contained in:
commit
7814173d72
@ -1,35 +0,0 @@
|
||||
"""add soft delete to application and environment resources and roles
|
||||
|
||||
Revision ID: 014e4bceb947
|
||||
Revises: 32438a35cfb5
|
||||
Create Date: 2019-04-10 09:40:37.688157
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import expression
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '014e4bceb947'
|
||||
down_revision = '32438a35cfb5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('application_roles', sa.Column('deleted', sa.Boolean(), server_default=expression.false(), nullable=False))
|
||||
op.add_column('applications', sa.Column('deleted', sa.Boolean(), server_default=expression.false(), nullable=False))
|
||||
op.add_column('environment_roles', sa.Column('deleted', sa.Boolean(), server_default=expression.false(), nullable=False))
|
||||
op.add_column('environments', sa.Column('deleted', sa.Boolean(), server_default=expression.false(), nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('environments', 'deleted')
|
||||
op.drop_column('environment_roles', 'deleted')
|
||||
op.drop_column('applications', 'deleted')
|
||||
op.drop_column('application_roles', 'deleted')
|
||||
# ### end Alembic commands ###
|
@ -1,50 +0,0 @@
|
||||
"""Add email to invite
|
||||
|
||||
Revision ID: 02d11579a581
|
||||
Revises: 4f46aecb337f
|
||||
Create Date: 2018-11-19 14:51:33.178358
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '02d11579a581'
|
||||
down_revision = '4f46aecb337f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('invitations', sa.Column('email', sa.String()))
|
||||
conn = op.get_bind()
|
||||
# Add non-null value to email column
|
||||
conn.execute(
|
||||
text(
|
||||
"""
|
||||
insert into invitations (email)
|
||||
select u.email
|
||||
from invitations i
|
||||
inner join workspace_roles wr on i.workspace_role_id = wr.id
|
||||
inner join users u on wr.user_id = u.id
|
||||
where i.email is null;
|
||||
"""
|
||||
)
|
||||
)
|
||||
conn.execute(
|
||||
text(
|
||||
"""
|
||||
update invitations
|
||||
set email = 'example@example.com'
|
||||
where email is null;
|
||||
"""
|
||||
)
|
||||
)
|
||||
op.alter_column('invitations', 'email', nullable=False)
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('invitations', 'email')
|
||||
# ### end Alembic commands ###
|
@ -1,30 +0,0 @@
|
||||
"""remove portfolio_roles role_id
|
||||
|
||||
Revision ID: 0e71ab219ada
|
||||
Revises: 938a31795096
|
||||
Create Date: 2019-03-12 05:58:17.029899
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0e71ab219ada'
|
||||
down_revision = '938a31795096'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('workspace_roles_role_id_fkey', 'portfolio_roles', type_='foreignkey')
|
||||
op.drop_column('portfolio_roles', 'role_id')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('portfolio_roles', sa.Column('role_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.create_foreign_key('workspace_roles_role_id_fkey', 'portfolio_roles', 'roles', ['role_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
@ -1,30 +0,0 @@
|
||||
"""Add Custom Clauses to Task Order
|
||||
|
||||
Revision ID: 0ff4c31c4d28
|
||||
Revises: da9d1c911a52
|
||||
Create Date: 2019-01-30 11:28:37.193854
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0ff4c31c4d28'
|
||||
down_revision = 'da9d1c911a52'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('task_orders', 'loa', type_=sa.String(), nullable=True)
|
||||
op.add_column('task_orders', sa.Column('custom_clauses', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'custom_clauses')
|
||||
op.alter_column('task_orders', 'loa', type_=sa.ARRAY(sa.String()), nullable=True)
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""User email no longer unique
|
||||
|
||||
Revision ID: 1880551a32e4
|
||||
Revises: 014e4bceb947
|
||||
Create Date: 2019-04-17 10:59:10.262137
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1880551a32e4'
|
||||
down_revision = '014e4bceb947'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('users_email_key', 'users', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_unique_constraint('users_email_key', 'users', ['email'])
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""change request foreign key to task order
|
||||
|
||||
Revision ID: 1c1394e496a7
|
||||
Revises: 3dc8b7961bd1
|
||||
Create Date: 2018-12-12 14:39:25.325640
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1c1394e496a7'
|
||||
down_revision = '3dc8b7961bd1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("requests", "task_order_id", new_column_name="legacy_task_order_id")
|
||||
op.drop_constraint('requests_task_order_id_fkey', 'requests', type_='foreignkey')
|
||||
op.create_foreign_key("requests_legacy_task_order_fkey", 'requests', 'legacy_task_orders', ['legacy_task_order_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("requests", "legacy_task_order_id", new_column_name="task_order_id")
|
||||
op.drop_constraint("requests_legacy_task_order_fkey" 'requests', type_='foreignkey')
|
||||
op.create_foreign_key('requests_task_order_id_fkey', 'requests', 'legacy_task_orders', ['task_order_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
@ -1,36 +0,0 @@
|
||||
"""Add PDF to Task Order
|
||||
|
||||
Revision ID: 1f690989e38e
|
||||
Revises: 0ff4c31c4d28
|
||||
Create Date: 2019-02-04 15:56:57.642156
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1f690989e38e'
|
||||
down_revision = '0ff4c31c4d28'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('pdf_attachment_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.drop_constraint('task_orders_attachments_attachment_id', 'task_orders', type_='foreignkey')
|
||||
op.alter_column('task_orders', 'attachment_id', new_column_name='csp_attachment_id')
|
||||
op.create_foreign_key('task_orders_attachments_pdf_attachment_id', 'task_orders', 'attachments', ['pdf_attachment_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_attachments_csp_attachment_id', 'task_orders', 'attachments', ['csp_attachment_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('task_orders_attachments_csp_attachment_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_attachments_pdf_attachment_id', 'task_orders', type_='foreignkey')
|
||||
op.alter_column('task_orders', 'csp_attachment_id', new_column_name='attachment_id')
|
||||
op.create_foreign_key('task_orders_attachments_attachment_id', 'task_orders', 'attachments', ['attachment_id'], ['id'])
|
||||
op.drop_column('task_orders', 'pdf_attachment_id')
|
||||
# ### end Alembic commands ###
|
@ -1,40 +0,0 @@
|
||||
"""add clin table
|
||||
|
||||
Revision ID: 24700d113ea9
|
||||
Revises: d73cba9a4259
|
||||
Create Date: 2019-05-31 10:28:20.983200
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '24700d113ea9'
|
||||
down_revision = 'd73cba9a4259'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('clins',
|
||||
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('task_order_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('number', sa.String(), nullable=False),
|
||||
sa.Column('loas', postgresql.ARRAY(sa.String()), server_default='{}', nullable=False),
|
||||
sa.Column('start_date', sa.Date(), nullable=False),
|
||||
sa.Column('end_date', sa.Date(), nullable=False),
|
||||
sa.Column('obligated_amount', sa.Numeric(scale=2), nullable=False),
|
||||
sa.ForeignKeyConstraint(['task_order_id'], ['task_orders.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('clins')
|
||||
# ### end Alembic commands ###
|
@ -1,59 +0,0 @@
|
||||
"""add application_roles
|
||||
|
||||
Revision ID: 32438a35cfb5
|
||||
Revises: 49e12ae7c9ca
|
||||
Create Date: 2019-04-04 06:49:57.693753
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '32438a35cfb5'
|
||||
down_revision = '49e12ae7c9ca'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('application_roles',
|
||||
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('application_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('status', sa.Enum('ACTIVE', 'DISABLED', 'PENDING', name='status', native_enum=False), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_id'], ['applications.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('application_role_user_application', 'application_roles', ['user_id', 'application_id'], unique=True)
|
||||
op.create_index(op.f('ix_application_roles_application_id'), 'application_roles', ['application_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_roles_user_id'), 'application_roles', ['user_id'], unique=False)
|
||||
op.create_table('application_roles_permission_sets',
|
||||
sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('permission_set_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_role_id'], ['application_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['permission_set_id'], ['permission_sets.id'], )
|
||||
)
|
||||
op.create_index(op.f('ix_permission_sets_name'), 'permission_sets', ['name'], unique=True)
|
||||
op.create_index(op.f('ix_permission_sets_permissions'), 'permission_sets', ['permissions'], unique=False)
|
||||
op.drop_index('ix_roles_name', table_name='permission_sets')
|
||||
op.drop_index('ix_roles_permissions', table_name='permission_sets')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('ix_roles_permissions', 'permission_sets', ['permissions'], unique=False)
|
||||
op.create_index('ix_roles_name', 'permission_sets', ['name'], unique=True)
|
||||
op.drop_index(op.f('ix_permission_sets_permissions'), table_name='permission_sets')
|
||||
op.drop_index(op.f('ix_permission_sets_name'), table_name='permission_sets')
|
||||
op.drop_table('application_roles_permission_sets')
|
||||
op.drop_index(op.f('ix_application_roles_user_id'), table_name='application_roles')
|
||||
op.drop_index(op.f('ix_application_roles_application_id'), table_name='application_roles')
|
||||
op.drop_index('application_role_user_application', table_name='application_roles')
|
||||
op.drop_table('application_roles')
|
||||
# ### end Alembic commands ###
|
@ -1,279 +0,0 @@
|
||||
"""initial
|
||||
|
||||
Revision ID: 359caaf8c5f1
|
||||
Revises:
|
||||
Create Date: 2018-09-20 10:25:44.438679
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '359caaf8c5f1'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
connection.execute('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"')
|
||||
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('attachments',
|
||||
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('filename', sa.String(), nullable=False),
|
||||
sa.Column('object_name', sa.String(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('object_name')
|
||||
)
|
||||
op.create_table('pe_numbers',
|
||||
sa.Column('number', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('number')
|
||||
)
|
||||
op.create_table('roles',
|
||||
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('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=False),
|
||||
sa.Column('permissions', postgresql.ARRAY(sa.String()), server_default='{}', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_roles_name'), 'roles', ['name'], unique=True)
|
||||
op.create_index(op.f('ix_roles_permissions'), 'roles', ['permissions'], unique=False)
|
||||
op.create_table('task_orders',
|
||||
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('number', sa.String(), nullable=True),
|
||||
sa.Column('source', sa.Enum('MANUAL', 'EDA', name='source', native_enum=False), nullable=True),
|
||||
sa.Column('funding_type', sa.Enum('RDTE', 'OM', 'PROC', 'OTHER', name='fundingtype', native_enum=False), nullable=True),
|
||||
sa.Column('funding_type_other', sa.String(), nullable=True),
|
||||
sa.Column('clin_0001', sa.Integer(), nullable=True),
|
||||
sa.Column('clin_0003', sa.Integer(), nullable=True),
|
||||
sa.Column('clin_1001', sa.Integer(), nullable=True),
|
||||
sa.Column('clin_1003', sa.Integer(), nullable=True),
|
||||
sa.Column('clin_2001', sa.Integer(), nullable=True),
|
||||
sa.Column('clin_2003', sa.Integer(), nullable=True),
|
||||
sa.Column('expiration_date', sa.Date(), nullable=True),
|
||||
sa.Column('attachment_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['attachment_id'], ['attachments.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('number')
|
||||
)
|
||||
op.create_table('users',
|
||||
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('username', sa.String(), nullable=True),
|
||||
sa.Column('atat_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=True),
|
||||
sa.Column('dod_id', sa.String(), nullable=False),
|
||||
sa.Column('first_name', sa.String(), nullable=True),
|
||||
sa.Column('last_name', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['atat_role_id'], ['roles.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('dod_id'),
|
||||
sa.UniqueConstraint('email')
|
||||
)
|
||||
op.create_table('request_reviews',
|
||||
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('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('comment', sa.String(), nullable=True),
|
||||
sa.Column('fname_mao', sa.String(), nullable=True),
|
||||
sa.Column('lname_mao', sa.String(), nullable=True),
|
||||
sa.Column('email_mao', sa.String(), nullable=True),
|
||||
sa.Column('phone_mao', sa.String(), nullable=True),
|
||||
sa.Column('fname_ccpo', sa.String(), nullable=True),
|
||||
sa.Column('lname_ccpo', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('requests',
|
||||
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('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('task_order_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['task_order_id'], ['task_orders.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('request_internal_comments',
|
||||
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('text', sa.String(), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('request_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('request_revisions',
|
||||
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('request_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('sequence', sa.BigInteger(), nullable=False),
|
||||
sa.Column('am_poc', sa.Boolean(), nullable=True),
|
||||
sa.Column('dodid_poc', sa.String(), nullable=True),
|
||||
sa.Column('email_poc', sa.String(), nullable=True),
|
||||
sa.Column('fname_poc', sa.String(), nullable=True),
|
||||
sa.Column('lname_poc', sa.String(), nullable=True),
|
||||
sa.Column('jedi_usage', sa.String(), nullable=True),
|
||||
sa.Column('start_date', sa.Date(), nullable=True),
|
||||
sa.Column('cloud_native', sa.String(), nullable=True),
|
||||
sa.Column('dollar_value', sa.Integer(), nullable=True),
|
||||
sa.Column('dod_component', sa.String(), nullable=True),
|
||||
sa.Column('data_transfers', sa.String(), nullable=True),
|
||||
sa.Column('expected_completion_date', sa.String(), nullable=True),
|
||||
sa.Column('jedi_migration', sa.String(), nullable=True),
|
||||
sa.Column('num_software_systems', sa.Integer(), nullable=True),
|
||||
sa.Column('number_user_sessions', sa.Integer(), nullable=True),
|
||||
sa.Column('average_daily_traffic', sa.Integer(), nullable=True),
|
||||
sa.Column('engineering_assessment', sa.String(), nullable=True),
|
||||
sa.Column('technical_support_team', sa.String(), nullable=True),
|
||||
sa.Column('estimated_monthly_spend', sa.Integer(), nullable=True),
|
||||
sa.Column('average_daily_traffic_gb', sa.Integer(), nullable=True),
|
||||
sa.Column('rationalization_software_systems', sa.String(), nullable=True),
|
||||
sa.Column('organization_providing_assistance', sa.String(), nullable=True),
|
||||
sa.Column('name', sa.String(), nullable=True),
|
||||
sa.Column('citizenship', sa.String(), nullable=True),
|
||||
sa.Column('designation', sa.String(), nullable=True),
|
||||
sa.Column('phone_number', sa.String(), nullable=True),
|
||||
sa.Column('email_request', sa.String(), nullable=True),
|
||||
sa.Column('fname_request', sa.String(), nullable=True),
|
||||
sa.Column('lname_request', sa.String(), nullable=True),
|
||||
sa.Column('service_branch', sa.String(), nullable=True),
|
||||
sa.Column('date_latest_training', sa.Date(), nullable=True),
|
||||
sa.Column('pe_id', sa.String(), nullable=True),
|
||||
sa.Column('task_order_number', sa.String(), nullable=True),
|
||||
sa.Column('fname_co', sa.String(), nullable=True),
|
||||
sa.Column('lname_co', sa.String(), nullable=True),
|
||||
sa.Column('email_co', sa.String(), nullable=True),
|
||||
sa.Column('office_co', sa.String(), nullable=True),
|
||||
sa.Column('fname_cor', sa.String(), nullable=True),
|
||||
sa.Column('lname_cor', sa.String(), nullable=True),
|
||||
sa.Column('email_cor', sa.String(), nullable=True),
|
||||
sa.Column('office_cor', sa.String(), nullable=True),
|
||||
sa.Column('uii_ids', postgresql.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column('treasury_code', sa.String(), nullable=True),
|
||||
sa.Column('ba_code', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('workspaces',
|
||||
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('name', sa.String(), nullable=True),
|
||||
sa.Column('request_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('projects',
|
||||
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('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=False),
|
||||
sa.Column('workspace_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('request_status_events',
|
||||
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('new_status', sa.Enum('STARTED', 'SUBMITTED', 'PENDING_FINANCIAL_VERIFICATION', 'PENDING_CCPO_ACCEPTANCE', 'PENDING_CCPO_APPROVAL', 'CHANGES_REQUESTED', 'CHANGES_REQUESTED_TO_FINVER', 'APPROVED', 'EXPIRED', 'DELETED', name='requeststatus', native_enum=False), nullable=True),
|
||||
sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('request_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('sequence', sa.BigInteger(), nullable=False),
|
||||
sa.Column('request_revision_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('request_review_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['request_review_id'], ['request_reviews.id'], ),
|
||||
sa.ForeignKeyConstraint(['request_revision_id'], ['request_revisions.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('workspace_roles',
|
||||
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('workspace_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('role_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_workspace_roles_user_id'), 'workspace_roles', ['user_id'], unique=False)
|
||||
op.create_index(op.f('ix_workspace_roles_workspace_id'), 'workspace_roles', ['workspace_id'], unique=False)
|
||||
op.create_index('workspace_role_user_workspace', 'workspace_roles', ['user_id', 'workspace_id'], unique=True)
|
||||
op.create_table('environments',
|
||||
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('name', sa.String(), nullable=False),
|
||||
sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('environment_roles',
|
||||
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('environment_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('role', sa.String(), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['environment_id'], ['environments.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('environments_role_user_environment', 'environment_roles', ['user_id', 'environment_id'], unique=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
connection.execute(
|
||||
"CREATE SEQUENCE request_status_events_sequence_seq OWNED BY request_status_events.sequence;"
|
||||
)
|
||||
connection.execute(
|
||||
"CREATE SEQUENCE request_revisions_sequence_seq OWNED BY request_revisions.sequence;"
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('environments_role_user_environment', table_name='environment_roles')
|
||||
op.drop_table('environment_roles')
|
||||
op.drop_table('environments')
|
||||
op.drop_index('workspace_role_user_workspace', table_name='workspace_roles')
|
||||
op.drop_index(op.f('ix_workspace_roles_workspace_id'), table_name='workspace_roles')
|
||||
op.drop_index(op.f('ix_workspace_roles_user_id'), table_name='workspace_roles')
|
||||
op.drop_table('workspace_roles')
|
||||
op.drop_table('request_status_events')
|
||||
op.drop_table('projects')
|
||||
op.drop_table('workspaces')
|
||||
op.drop_table('request_revisions')
|
||||
op.drop_table('request_internal_comments')
|
||||
op.drop_table('requests')
|
||||
op.drop_table('request_reviews')
|
||||
op.drop_table('users')
|
||||
op.drop_table('task_orders')
|
||||
op.drop_index(op.f('ix_roles_permissions'), table_name='roles')
|
||||
op.drop_index(op.f('ix_roles_name'), table_name='roles')
|
||||
op.drop_table('roles')
|
||||
op.drop_table('pe_numbers')
|
||||
op.drop_table('attachments')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
connection = op.get_bind()
|
||||
connection.execute('DROP EXTENSION IF EXISTS "uuid-ossp"')
|
@ -1,46 +0,0 @@
|
||||
"""Add indexes
|
||||
|
||||
Revision ID: 3777e9e39644
|
||||
Revises: fa3ba4049218
|
||||
Create Date: 2019-02-20 15:57:44.531311
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3777e9e39644'
|
||||
down_revision = 'fa3ba4049218'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index(op.f('ix_audit_events_portfolio_id'), 'audit_events', ['portfolio_id'], unique=False)
|
||||
op.drop_index('ix_audit_events_workspace_id', table_name='audit_events')
|
||||
op.create_index(op.f('ix_invitations_portfolio_role_id'), 'invitations', ['portfolio_role_id'], unique=False)
|
||||
op.drop_index('ix_invitations_workspace_role_id', table_name='invitations')
|
||||
op.create_index(op.f('ix_portfolio_roles_portfolio_id'), 'portfolio_roles', ['portfolio_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_roles_user_id'), 'portfolio_roles', ['user_id'], unique=False)
|
||||
op.create_index('portfolio_role_user_portfolio', 'portfolio_roles', ['user_id', 'portfolio_id'], unique=True)
|
||||
op.drop_index('ix_workspace_roles_user_id', table_name='portfolio_roles')
|
||||
op.drop_index('ix_workspace_roles_workspace_id', table_name='portfolio_roles')
|
||||
op.drop_index('workspace_role_user_workspace', table_name='portfolio_roles')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('workspace_role_user_workspace', 'portfolio_roles', ['user_id', 'portfolio_id'], unique=True)
|
||||
op.create_index('ix_workspace_roles_workspace_id', 'portfolio_roles', ['portfolio_id'], unique=False)
|
||||
op.create_index('ix_workspace_roles_user_id', 'portfolio_roles', ['user_id'], unique=False)
|
||||
op.drop_index('portfolio_role_user_portfolio', table_name='portfolio_roles')
|
||||
op.drop_index(op.f('ix_portfolio_roles_user_id'), table_name='portfolio_roles')
|
||||
op.drop_index(op.f('ix_portfolio_roles_portfolio_id'), table_name='portfolio_roles')
|
||||
op.create_index('ix_invitations_workspace_role_id', 'invitations', ['portfolio_role_id'], unique=False)
|
||||
op.drop_index(op.f('ix_invitations_portfolio_role_id'), table_name='invitations')
|
||||
op.create_index('ix_audit_events_workspace_id', 'audit_events', ['portfolio_id'], unique=False)
|
||||
op.drop_index(op.f('ix_audit_events_portfolio_id'), table_name='audit_events')
|
||||
# ### end Alembic commands ###
|
@ -1,31 +0,0 @@
|
||||
"""Add status enum to task_order
|
||||
|
||||
Revision ID: 3d346b5c8f19
|
||||
Revises: 71cbe76c3b87
|
||||
Create Date: 2019-01-10 13:55:58.934890
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3d346b5c8f19'
|
||||
down_revision = '71cbe76c3b87'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('status', sa.Enum('PENDING', name='status', native_enum=False), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
conn = op.get_bind()
|
||||
conn.execute("UPDATE task_orders set status = 'PENDING'")
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'status')
|
||||
# ### end Alembic commands ###
|
@ -1,43 +0,0 @@
|
||||
"""Nullable fields for CLINs
|
||||
|
||||
|
||||
Revision ID: 3d3c71b03e98
|
||||
Revises: b565531a1e82
|
||||
Create Date: 2019-06-17 11:04:03.294913
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3d3c71b03e98'
|
||||
down_revision = 'b565531a1e82'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('clins', 'end_date',
|
||||
existing_type=sa.DATE(),
|
||||
nullable=True)
|
||||
op.alter_column('clins', 'jedi_clin_type',
|
||||
existing_type=sa.VARCHAR(length=11),
|
||||
nullable=True)
|
||||
op.alter_column('clins', 'loas',
|
||||
existing_type=postgresql.ARRAY(sa.VARCHAR()),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("'{}'::character varying[]"))
|
||||
op.alter_column('clins', 'number',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=True)
|
||||
op.alter_column('clins', 'obligated_amount',
|
||||
existing_type=sa.NUMERIC(),
|
||||
nullable=True)
|
||||
op.alter_column('clins', 'start_date',
|
||||
existing_type=sa.DATE(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
"""rename task orders
|
||||
|
||||
Revision ID: 3dc8b7961bd1
|
||||
Revises: c222327c3963
|
||||
Create Date: 2018-12-12 13:17:25.728679
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3dc8b7961bd1'
|
||||
down_revision = 'c222327c3963'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.rename_table("task_orders", "legacy_task_orders")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.rename_table("legacy_task_orders", "task_orders")
|
@ -1,34 +0,0 @@
|
||||
"""add_notification_recipients
|
||||
|
||||
Revision ID: 404bb5bb3a0e
|
||||
Revises: 432c5287256d
|
||||
Create Date: 2019-05-10 15:25:22.627996
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '404bb5bb3a0e'
|
||||
down_revision = '432c5287256d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('notification_recipients',
|
||||
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('email', sa.String(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('notification_recipients')
|
||||
# ### end Alembic commands ###
|
@ -1,69 +0,0 @@
|
||||
"""add application_invitation
|
||||
|
||||
Revision ID: 432c5287256d
|
||||
Revises: 1880551a32e4
|
||||
Create Date: 2019-04-23 09:23:05.738680
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '432c5287256d'
|
||||
down_revision = '1880551a32e4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.rename_table('invitations', 'portfolio_invitations')
|
||||
op.create_table('application_invitations',
|
||||
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('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED_WRONG_USER', 'REJECTED_EXPIRED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('expiration_time', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=False),
|
||||
sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_role_id'], ['application_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['inviter_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_application_invitations_application_role_id'), 'application_invitations', ['application_role_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_inviter_id'), 'application_invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_token'), 'application_invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_user_id'), 'application_invitations', ['user_id'], unique=False)
|
||||
op.drop_index('ix_invitations_inviter_id', table_name='invitations')
|
||||
op.drop_index('ix_invitations_portfolio_role_id', table_name='invitations')
|
||||
op.drop_index('ix_invitations_token', table_name='invitations')
|
||||
op.drop_index('ix_invitations_user_id', table_name='invitations')
|
||||
op.create_index(op.f('ix_portfolio_invitations_inviter_id'), 'portfolio_invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_portfolio_role_id'), 'portfolio_invitations', ['portfolio_role_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_token'), 'portfolio_invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_user_id'), 'portfolio_invitations', ['user_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.rename_table('portfolio_invitations', 'invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_user_id'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_token'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_inviter_id'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_application_role_id'), table_name='application_invitations')
|
||||
op.drop_table('application_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_user_id'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_token'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_portfolio_role_id'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_inviter_id'), table_name='portfolio_invitations')
|
||||
op.create_index('ix_invitations_user_id', 'invitations', ['user_id'], unique=False)
|
||||
op.create_index('ix_invitations_token', 'invitations', ['token'], unique=False)
|
||||
op.create_index('ix_invitations_portfolio_role_id', 'invitations', ['portfolio_role_id'], unique=False)
|
||||
op.create_index('ix_invitations_inviter_id', 'invitations', ['inviter_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""add funding columns to task order
|
||||
|
||||
Revision ID: 4536f50b25bc
|
||||
Revises: 3d346b5c8f19
|
||||
Create Date: 2019-01-10 14:24:03.101309
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4536f50b25bc'
|
||||
down_revision = '3d346b5c8f19'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('attachment_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('performance_length', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key('task_orders_attachments_attachment_id', 'task_orders', 'attachments', ['attachment_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('task_orders_attachments_attachment_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_column('task_orders', 'performance_length')
|
||||
op.drop_column('task_orders', 'attachment_id')
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""add last login to user
|
||||
|
||||
Revision ID: 49e12ae7c9ca
|
||||
Revises: fc08d99bb7f7
|
||||
Create Date: 2019-03-28 15:46:58.226281
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '49e12ae7c9ca'
|
||||
down_revision = 'fc08d99bb7f7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('last_login', sa.TIMESTAMP(timezone=True), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'last_login')
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""Add Phone Extension
|
||||
|
||||
Revision ID: 4c0b8263d800
|
||||
Revises: ea8b5681b37c
|
||||
Create Date: 2018-10-29 11:14:01.332665
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4c0b8263d800'
|
||||
down_revision = 'ea8b5681b37c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('request_reviews', sa.Column('phone_ext_mao', sa.String(), nullable=True))
|
||||
op.add_column('request_revisions', sa.Column('phone_ext', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('phone_ext', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'phone_ext')
|
||||
op.drop_column('request_revisions', 'phone_ext')
|
||||
op.drop_column('request_reviews', 'phone_ext_mao')
|
||||
# ### end Alembic commands ###
|
@ -1,30 +0,0 @@
|
||||
"""Add columns to AuditEvent
|
||||
|
||||
Revision ID: 4f46aecb337f
|
||||
Revises: 4c0b8263d800
|
||||
Create Date: 2018-11-12 16:03:55.281648
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4f46aecb337f'
|
||||
down_revision = '4c0b8263d800'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('audit_events', sa.Column('changed_state', postgresql.JSON(astext_type=sa.Text()), nullable=True))
|
||||
op.add_column('audit_events', sa.Column('event_details', postgresql.JSON(astext_type=sa.Text()), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('audit_events', 'event_details')
|
||||
op.drop_column('audit_events', 'changed_state')
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""add provisional column to users
|
||||
|
||||
Revision ID: 5284ac1ac77c
|
||||
Revises: e0fc3cd315c1
|
||||
Create Date: 2018-10-25 11:04:49.879393
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5284ac1ac77c'
|
||||
down_revision = 'e0fc3cd315c1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('provisional', sa.Boolean(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'provisional')
|
||||
# ### end Alembic commands ###
|
@ -1,78 +0,0 @@
|
||||
"""new task order table
|
||||
|
||||
Revision ID: 6172ac7b8b26
|
||||
Revises: 1c1394e496a7
|
||||
Create Date: 2018-12-19 10:00:51.373083
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6172ac7b8b26'
|
||||
down_revision = '1c1394e496a7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('task_orders',
|
||||
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('workspace_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('scope', sa.String(), nullable=True),
|
||||
sa.Column('defense_component', sa.String(), nullable=True),
|
||||
sa.Column('app_migration', sa.String(), nullable=True),
|
||||
sa.Column('native_apps', sa.String(), nullable=True),
|
||||
sa.Column('complexity', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column('complexity_other', sa.String(), nullable=True),
|
||||
sa.Column('dev_team', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column('dev_team_other', sa.String(), nullable=True),
|
||||
sa.Column('team_experience', sa.String(), nullable=True),
|
||||
sa.Column('start_date', sa.Date(), nullable=True),
|
||||
sa.Column('end_date', sa.Date(), nullable=True),
|
||||
sa.Column('clin_01', sa.Numeric(scale=2), nullable=True),
|
||||
sa.Column('clin_02', sa.Numeric(scale=2), nullable=True),
|
||||
sa.Column('clin_03', sa.Numeric(scale=2), nullable=True),
|
||||
sa.Column('clin_04', sa.Numeric(scale=2), nullable=True),
|
||||
sa.Column('ko_first_name', sa.String(), nullable=True),
|
||||
sa.Column('ko_last_name', sa.String(), nullable=True),
|
||||
sa.Column('ko_email', sa.String(), nullable=True),
|
||||
sa.Column('ko_dod_id', sa.String(), nullable=True),
|
||||
sa.Column('cor_first_name', sa.String(), nullable=True),
|
||||
sa.Column('cor_last_name', sa.String(), nullable=True),
|
||||
sa.Column('cor_email', sa.String(), nullable=True),
|
||||
sa.Column('cor_dod_id', sa.String(), nullable=True),
|
||||
sa.Column('so_first_name', sa.String(), nullable=True),
|
||||
sa.Column('so_last_name', sa.String(), nullable=True),
|
||||
sa.Column('so_email', sa.String(), nullable=True),
|
||||
sa.Column('so_dod_id', sa.String(), nullable=True),
|
||||
sa.Column('number', sa.String(), nullable=True),
|
||||
sa.Column('loa', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('number')
|
||||
)
|
||||
op.alter_column('workspaces', 'request_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("DELETE FROM workspace_roles wr USING workspaces w WHERE w.id=wr.workspace_id AND w.request_id IS NULL")
|
||||
conn.execute("DELETE FROM audit_events ae USING workspaces w WHERE w.id=ae.workspace_id AND w.request_id IS NULL")
|
||||
conn.execute("DELETE FROM task_orders tasks USING workspaces w WHERE w.id=tasks.workspace_id AND w.request_id IS NULL")
|
||||
conn.execute("DELETE FROM workspaces WHERE request_id IS NULL")
|
||||
op.alter_column('workspaces', 'request_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
op.drop_table('task_orders')
|
||||
# ### end Alembic commands ###
|
@ -1,29 +0,0 @@
|
||||
"""Default Boolean fields to False
|
||||
|
||||
Revision ID: 6512aa8d4641
|
||||
Revises: ec1ba2363191
|
||||
Create Date: 2019-02-27 13:22:03.863516
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6512aa8d4641'
|
||||
down_revision = 'ec1ba2363191'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('task_orders', 'cor_invite', type_=sa.Boolean(), server_default=False)
|
||||
op.alter_column('task_orders', 'ko_invite', type_=sa.Boolean(), server_default=False)
|
||||
op.alter_column('task_orders', 'so_invite', type_=sa.Boolean(), server_default=False)
|
||||
op.alter_column('task_orders', 'unlimited_level_of_warrant', type_=sa.Boolean(), server_default=False)
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('task_orders', 'cor_invite', type_=sa.Boolean(), server_default=None)
|
||||
op.alter_column('task_orders', 'ko_invite', type_=sa.Boolean(), server_default=None)
|
||||
op.alter_column('task_orders', 'so_invite', type_=sa.Boolean(), server_default=None)
|
||||
op.alter_column('task_orders', 'unlimited_level_of_warrant', type_=sa.Boolean(), server_default=None)
|
@ -1,38 +0,0 @@
|
||||
"""add officers to task order
|
||||
|
||||
Revision ID: 71cbe76c3b87
|
||||
Revises: 91bd9482ce23
|
||||
Create Date: 2019-01-04 10:16:50.062349
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '71cbe76c3b87'
|
||||
down_revision = '91bd9482ce23'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('cor_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_foreign_key('task_orders_users_so_id', 'task_orders', 'users', ['so_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_users_cor_id', 'task_orders', 'users', ['cor_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_users_ko_id', 'task_orders', 'users', ['ko_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('task_orders_users_so_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_users_cor_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_users_ko_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_column('task_orders', 'so_id')
|
||||
op.drop_column('task_orders', 'ko_id')
|
||||
op.drop_column('task_orders', 'cor_id')
|
||||
# ### end Alembic commands ###
|
@ -1,38 +0,0 @@
|
||||
"""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')
|
@ -1,32 +0,0 @@
|
||||
"""add oversight columns to task order
|
||||
|
||||
Revision ID: 7f2040715b0d
|
||||
Revises: 4536f50b25bc
|
||||
Create Date: 2019-01-10 16:34:20.185768
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7f2040715b0d'
|
||||
down_revision = '4536f50b25bc'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('cor_phone_number', sa.String(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_phone_number', sa.String(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_phone_number', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'so_phone_number')
|
||||
op.drop_column('task_orders', 'ko_phone_number')
|
||||
op.drop_column('task_orders', 'cor_phone_number')
|
||||
# ### end Alembic commands ###
|
@ -1,54 +0,0 @@
|
||||
"""add user data fields to invitations
|
||||
|
||||
Revision ID: 8467440c4ae6
|
||||
Revises: 24700d113ea9
|
||||
Create Date: 2019-05-31 12:40:10.457529
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8467440c4ae6'
|
||||
down_revision = '24700d113ea9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('application_invitations', sa.Column('dod_id', sa.String(), nullable=True))
|
||||
op.add_column('application_invitations', sa.Column('first_name', sa.String(), nullable=True))
|
||||
op.add_column('application_invitations', sa.Column('last_name', sa.String(), nullable=True))
|
||||
op.add_column('application_invitations', sa.Column('phone_number', sa.String(), nullable=True))
|
||||
op.alter_column('application_roles', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
op.add_column('portfolio_invitations', sa.Column('dod_id', sa.String(), nullable=True))
|
||||
op.add_column('portfolio_invitations', sa.Column('first_name', sa.String(), nullable=True))
|
||||
op.add_column('portfolio_invitations', sa.Column('last_name', sa.String(), nullable=True))
|
||||
op.add_column('portfolio_invitations', sa.Column('phone_number', sa.String(), nullable=True))
|
||||
op.alter_column('portfolio_roles', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('portfolio_roles', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
op.drop_column('portfolio_invitations', 'phone_number')
|
||||
op.drop_column('portfolio_invitations', 'last_name')
|
||||
op.drop_column('portfolio_invitations', 'first_name')
|
||||
op.drop_column('portfolio_invitations', 'dod_id')
|
||||
op.alter_column('application_roles', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
op.drop_column('application_invitations', 'phone_number')
|
||||
op.drop_column('application_invitations', 'last_name')
|
||||
op.drop_column('application_invitations', 'first_name')
|
||||
op.drop_column('application_invitations', 'dod_id')
|
||||
# ### end Alembic commands ###
|
@ -1,46 +0,0 @@
|
||||
"""add audit_events table
|
||||
|
||||
Revision ID: 875841fac207
|
||||
Revises: 2572be7fb7fc
|
||||
Create Date: 2018-09-13 15:34:18.815205
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '875841fac207'
|
||||
down_revision = 'c19ae79d2521'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('audit_events',
|
||||
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('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('resource_type', sa.String(), nullable=False),
|
||||
sa.Column('display_name', sa.String(), nullable=True),
|
||||
sa.Column('resource_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('action', sa.String(), nullable=False),
|
||||
sa.Column('workspace_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('request_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id']),
|
||||
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id']),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_audit_events_resource_id'), 'audit_events', ['resource_id'], unique=False)
|
||||
op.create_index(op.f('ix_audit_events_user_id'), 'audit_events', ['user_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_audit_events_user_id'), table_name='audit_events')
|
||||
op.drop_index(op.f('ix_audit_events_resource_id'), table_name='audit_events')
|
||||
op.drop_table('audit_events')
|
||||
# ### end Alembic commands ###
|
@ -1,42 +0,0 @@
|
||||
"""remove workspaces.name unique constraint
|
||||
|
||||
Revision ID: 903d7c66ff1d
|
||||
Revises: 875841fac207
|
||||
Create Date: 2018-09-26 10:19:13.230064
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '903d7c66ff1d'
|
||||
down_revision = '875841fac207'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index(op.f('ix_audit_events_request_id'), 'audit_events', ['request_id'], unique=False)
|
||||
op.create_index(op.f('ix_audit_events_workspace_id'), 'audit_events', ['workspace_id'], unique=False)
|
||||
op.create_foreign_key(None, 'audit_events', 'requests', ['request_id'], ['id'])
|
||||
op.alter_column('request_status_events', 'time_created',
|
||||
existing_type=postgresql.TIMESTAMP(timezone=True),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text('now()'))
|
||||
op.drop_constraint('workspaces_name_key', 'workspaces', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_unique_constraint('workspaces_name_key', 'workspaces', ['name'])
|
||||
op.alter_column('request_status_events', 'time_created',
|
||||
existing_type=postgresql.TIMESTAMP(timezone=True),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text('now()'))
|
||||
op.drop_constraint(None, 'audit_events', type_='foreignkey')
|
||||
op.drop_index(op.f('ix_audit_events_workspace_id'), table_name='audit_events')
|
||||
op.drop_index(op.f('ix_audit_events_request_id'), table_name='audit_events')
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""Add cloud_id column to user
|
||||
|
||||
Revision ID: 91bd9482ce23
|
||||
Revises: b3fa1493e0a9
|
||||
Create Date: 2019-01-08 10:18:23.764179
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '91bd9482ce23'
|
||||
down_revision = 'b3fa1493e0a9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('cloud_id', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'cloud_id')
|
||||
# ### end Alembic commands ###
|
@ -1,33 +0,0 @@
|
||||
"""add permission sets to portfolio_role
|
||||
|
||||
Revision ID: 938a31795096
|
||||
Revises: db161adbafdf
|
||||
Create Date: 2019-03-07 06:13:05.400911
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '938a31795096'
|
||||
down_revision = 'db161adbafdf'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('portfolio_roles_roles',
|
||||
sa.Column('portfolio_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['portfolio_role_id'], ['portfolio_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], )
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('portfolio_roles_roles')
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""Remove PE number model
|
||||
|
||||
Revision ID: 978bf56e21b6
|
||||
Revises: c92cec2f32d4
|
||||
Create Date: 2019-02-20 18:24:37.970323
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '978bf56e21b6'
|
||||
down_revision = 'c92cec2f32d4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('pe_numbers')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('pe_numbers',
|
||||
sa.Column('number', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('description', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('number', name='pe_numbers_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
@ -1,42 +0,0 @@
|
||||
"""Portfolio demographics
|
||||
|
||||
Revision ID: 988f8b23fbf6
|
||||
Revises: 8467440c4ae6
|
||||
Create Date: 2019-05-31 14:00:31.197803
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '988f8b23fbf6'
|
||||
down_revision = '8467440c4ae6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('portfolios', sa.Column('app_migration', sa.String(), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('complexity', sa.ARRAY(sa.String()), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('complexity_other', sa.String(), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('description', sa.String(), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('dev_team', sa.ARRAY(sa.String()), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('dev_team_other', sa.String(), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('native_apps', sa.String(), nullable=True))
|
||||
op.add_column('portfolios', sa.Column('team_experience', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('portfolios', 'team_experience')
|
||||
op.drop_column('portfolios', 'native_apps')
|
||||
op.drop_column('portfolios', 'dev_team_other')
|
||||
op.drop_column('portfolios', 'dev_team')
|
||||
op.drop_column('portfolios', 'description')
|
||||
op.drop_column('portfolios', 'complexity_other')
|
||||
op.drop_column('portfolios', 'complexity')
|
||||
op.drop_column('portfolios', 'app_migration')
|
||||
# ### end Alembic commands ###
|
@ -1,50 +0,0 @@
|
||||
"""add invitations
|
||||
|
||||
Revision ID: 994a80ee92c9
|
||||
Revises: 9c24c609878a
|
||||
Create Date: 2018-10-30 16:49:53.688621
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '994a80ee92c9'
|
||||
down_revision = '9c24c609878a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('invitations',
|
||||
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('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('workspace_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('expiration_time', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['inviter_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['workspace_role_id'], ['workspace_roles.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_invitations_inviter_id'), 'invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_token'), 'invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_user_id'), 'invitations', ['user_id'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_workspace_role_id'), 'invitations', ['workspace_role_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_invitations_workspace_role_id'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_user_id'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_token'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_inviter_id'), table_name='invitations')
|
||||
op.drop_table('invitations')
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""resource attachments
|
||||
|
||||
Revision ID: 9c24c609878a
|
||||
Revises: 903d7c66ff1d
|
||||
Create Date: 2018-10-18 17:14:25.566215
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9c24c609878a'
|
||||
down_revision = 'c99026ab9918'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('attachments', sa.Column('resource', sa.String(), nullable=True))
|
||||
op.add_column('attachments', sa.Column('resource_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_index(op.f('ix_attachments_resource_id'), 'attachments', ['resource_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_attachments_resource_id'), table_name='attachments')
|
||||
op.drop_column('attachments', 'resource_id')
|
||||
op.drop_column('attachments', 'resource')
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""rename roles table to permission_sets
|
||||
|
||||
Revision ID: a19138e386c4
|
||||
Revises: 0e71ab219ada
|
||||
Create Date: 2019-03-13 10:18:35.770296
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a19138e386c4'
|
||||
down_revision = '0e71ab219ada'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.rename_table("roles", "permission_sets")
|
||||
op.rename_table("portfolio_roles_roles", "portfolio_roles_permission_sets")
|
||||
op.alter_column("portfolio_roles_permission_sets", "role_id", new_column_name="permission_set_id")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.rename_table("permission_sets", "roles")
|
||||
op.alter_column("portfolio_roles_permission_sets", "permission_set_id", new_column_name="role_id")
|
||||
op.rename_table("portfolio_roles_permission_sets", "portfolio_roles_roles")
|
@ -1,28 +0,0 @@
|
||||
"""change workspace and project tables
|
||||
|
||||
Revision ID: a6837632686c
|
||||
Revises: acd0c11be93a
|
||||
Create Date: 2019-01-11 10:36:55.030308
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a6837632686c'
|
||||
down_revision = 'acd0c11be93a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.rename_table("workspaces", "portfolios")
|
||||
op.rename_table("projects", "applications")
|
||||
op.rename_table("workspace_roles", "portfolio_roles")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.rename_table("portfolios", "workspaces")
|
||||
op.rename_table("applications", "projects")
|
||||
op.rename_table("portfolio_roles", "workspace_roles")
|
@ -1,30 +0,0 @@
|
||||
"""status for existing workspace roles
|
||||
|
||||
Revision ID: a9d8c6b6221c
|
||||
Revises: 5284ac1ac77c
|
||||
Create Date: 2018-10-31 11:08:05.791739
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a9d8c6b6221c'
|
||||
down_revision = '5284ac1ac77c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("UPDATE workspace_roles set status = 'ACTIVE'")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("UPDATE workspace_roles set status = null")
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""add_user_last_session_id
|
||||
|
||||
Revision ID: ab1167fc8260
|
||||
Revises: c5deba1826be
|
||||
Create Date: 2019-05-15 16:25:48.766451
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ab1167fc8260'
|
||||
down_revision = 'c5deba1826be'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('last_session_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'last_session_id')
|
||||
# ### end Alembic commands ###
|
@ -1,34 +0,0 @@
|
||||
"""change workspace and project
|
||||
|
||||
Revision ID: acd0c11be93a
|
||||
Revises: 7f2040715b0d
|
||||
Create Date: 2019-01-11 10:01:07.667126
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'acd0c11be93a'
|
||||
down_revision = '7f2040715b0d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('audit_events', "workspace_id", new_column_name="portfolio_id")
|
||||
op.alter_column('environments', "project_id", new_column_name="application_id")
|
||||
op.alter_column('projects', "workspace_id", new_column_name="portfolio_id")
|
||||
op.alter_column('task_orders', "workspace_id", new_column_name="portfolio_id")
|
||||
op.alter_column('workspace_roles', "workspace_id", new_column_name="portfolio_id")
|
||||
op.alter_column('invitations', "workspace_role_id", new_column_name="portfolio_role_id")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('audit_events', "portfolio_id", new_column_name="workspace_id")
|
||||
op.alter_column('environments', "application_id", new_column_name="project_id")
|
||||
op.alter_column('projects', "portfolio_id", new_column_name="workspace_id")
|
||||
op.alter_column('task_orders', "portfolio_id", new_column_name="workspace_id")
|
||||
op.alter_column('workspace_roles', "portfolio_id", new_column_name="workspace_id")
|
||||
op.alter_column('invitations', "portfolio_role_id", new_column_name="workspace_role_id")
|
@ -1,34 +0,0 @@
|
||||
"""Record signer DOD ID
|
||||
|
||||
Revision ID: b3a1a07cf30b
|
||||
Revises: c98adf9bb431
|
||||
Create Date: 2019-02-12 10:16:19.349083
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b3a1a07cf30b'
|
||||
down_revision = 'c98adf9bb431'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('level_of_warrant', sa.Numeric(scale=2), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('signed_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('signer_dod_id', sa.String(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('unlimited_level_of_warrant', sa.Boolean(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'unlimited_level_of_warrant')
|
||||
op.drop_column('task_orders', 'signer_dod_id')
|
||||
op.drop_column('task_orders', 'signed_at')
|
||||
op.drop_column('task_orders', 'level_of_warrant')
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""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 ###
|
@ -1,28 +0,0 @@
|
||||
"""Portfolio deletable
|
||||
|
||||
Revision ID: b565531a1e82
|
||||
Revises: c19d6129cca1
|
||||
Create Date: 2019-06-06 09:16:08.803603
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b565531a1e82'
|
||||
down_revision = 'c19d6129cca1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('portfolios', sa.Column('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('portfolios', 'deleted')
|
||||
# ### end Alembic commands ###
|
@ -1,45 +0,0 @@
|
||||
"""add role.display_name
|
||||
|
||||
Revision ID: c19ae79d2521
|
||||
Revises: 359caaf8c5f1
|
||||
Create Date: 2018-09-24 14:02:59.533928
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "c19ae79d2521"
|
||||
down_revision = "359caaf8c5f1"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column(
|
||||
"request_status_events",
|
||||
"time_created",
|
||||
existing_type=postgresql.TIMESTAMP(timezone=True),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("now()"),
|
||||
)
|
||||
op.add_column(
|
||||
"roles",
|
||||
sa.Column("display_name", sa.String(), nullable=False, server_default=""),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column("roles", "display_name")
|
||||
op.alter_column(
|
||||
"request_status_events",
|
||||
"time_created",
|
||||
existing_type=postgresql.TIMESTAMP(timezone=True),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("now()"),
|
||||
)
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""add jedi clin type to clin table
|
||||
|
||||
Revision ID: c19d6129cca1
|
||||
Revises: 988f8b23fbf6
|
||||
Create Date: 2019-06-04 11:30:25.283028
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c19d6129cca1'
|
||||
down_revision = '988f8b23fbf6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('clins', sa.Column('jedi_clin_type', sa.Enum('JEDI_CLIN_1', 'JEDI_CLIN_2', 'JEDI_CLIN_3', 'JEDI_CLIN_4', name='jediclintype', native_enum=False), nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('clins', 'jedi_clin_type')
|
||||
# ### end Alembic commands ###
|
@ -1,46 +0,0 @@
|
||||
"""stop updates of dod id
|
||||
|
||||
Revision ID: c222327c3963
|
||||
Revises: 02d11579a581
|
||||
Create Date: 2018-12-12 10:23:00.773973
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c222327c3963'
|
||||
down_revision = '02d11579a581'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
connection.execute("""
|
||||
CREATE OR REPLACE FUNCTION lock_dod_id()
|
||||
RETURNS TRIGGER
|
||||
AS $$
|
||||
BEGIN
|
||||
IF NEW.dod_id != OLD.dod_id THEN
|
||||
RAISE EXCEPTION 'DOD ID cannot be updated';
|
||||
END IF;
|
||||
|
||||
RETURN NEW;
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER lock_dod_id
|
||||
BEFORE UPDATE ON users
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE lock_dod_id();
|
||||
""")
|
||||
|
||||
|
||||
def downgrade():
|
||||
connection = op.get_bind()
|
||||
connection.execute("""
|
||||
DROP TRIGGER IF EXISTS lock_dod_id ON users;
|
||||
DROP FUNCTION IF EXISTS lock_dod_id();
|
||||
""")
|
@ -1,32 +0,0 @@
|
||||
"""add_appliction_id_to_auditevent
|
||||
|
||||
Revision ID: c5deba1826be
|
||||
Revises: 404bb5bb3a0e
|
||||
Create Date: 2019-05-15 16:30:27.981456
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c5deba1826be'
|
||||
down_revision = '404bb5bb3a0e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('audit_events', sa.Column('application_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_index(op.f('ix_audit_events_application_id'), 'audit_events', ['application_id'], unique=False)
|
||||
op.create_foreign_key('audit_events_application_application_id', 'audit_events', 'applications', ['application_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('audit_events_application_application_id', 'audit_events', type_='foreignkey')
|
||||
op.drop_index(op.f('ix_audit_events_application_id'), table_name='audit_events')
|
||||
op.drop_column('audit_events', 'application_id')
|
||||
# ### end Alembic commands ###
|
@ -1,150 +0,0 @@
|
||||
"""Remove request related models
|
||||
|
||||
Revision ID: c92cec2f32d4
|
||||
Revises: 3777e9e39644
|
||||
Create Date: 2019-02-20 17:37:33.992269
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c92cec2f32d4'
|
||||
down_revision = '3777e9e39644'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('request_status_events')
|
||||
op.drop_table('request_reviews')
|
||||
op.drop_table('request_internal_comments')
|
||||
op.drop_table('request_revisions')
|
||||
op.drop_index('ix_audit_events_request_id', table_name='audit_events')
|
||||
op.drop_constraint('audit_events_request_id_fkey', 'audit_events', type_='foreignkey')
|
||||
op.drop_column('audit_events', 'request_id')
|
||||
op.drop_constraint('workspaces_request_id_fkey', 'portfolios', type_='foreignkey')
|
||||
op.drop_table('requests')
|
||||
op.drop_column('portfolios', 'request_id')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('portfolios', sa.Column('request_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('audit_events', sa.Column('request_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.create_table('requests',
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('legacy_task_order_id', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['legacy_task_order_id'], ['legacy_task_orders.id'], name='requests_legacy_task_order_fkey'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='requests_user_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='requests_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_index('ix_audit_events_request_id', 'audit_events', ['request_id'], unique=False)
|
||||
op.create_table('request_revisions',
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('request_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('sequence', sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column('am_poc', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.Column('dodid_poc', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('email_poc', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_poc', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_poc', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('jedi_usage', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('start_date', sa.DATE(), autoincrement=False, nullable=True),
|
||||
sa.Column('cloud_native', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('dollar_value', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('dod_component', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('data_transfers', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('expected_completion_date', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('jedi_migration', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('num_software_systems', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('number_user_sessions', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('average_daily_traffic', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('engineering_assessment', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('technical_support_team', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('estimated_monthly_spend', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('average_daily_traffic_gb', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('rationalization_software_systems', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('organization_providing_assistance', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('citizenship', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('designation', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone_number', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('email_request', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_request', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_request', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('service_branch', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('date_latest_training', sa.DATE(), autoincrement=False, nullable=True),
|
||||
sa.Column('pe_id', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('task_order_number', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_co', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_co', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('email_co', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('office_co', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_cor', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_cor', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('email_cor', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('office_cor', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('uii_ids', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
|
||||
sa.Column('treasury_code', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('ba_code', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone_ext', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], name='request_revisions_request_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='request_revisions_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('request_internal_comments',
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('text', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('request_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], name='request_internal_comments_request_id_fkey', ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='request_internal_comments_user_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='request_internal_comments_pkey')
|
||||
)
|
||||
op.create_table('request_reviews',
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('comment', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_mao', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_mao', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('email_mao', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone_mao', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('fname_ccpo', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('lname_ccpo', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('phone_ext_mao', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='request_reviews_user_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='request_reviews_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('request_status_events',
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('new_status', sa.VARCHAR(length=30), autoincrement=False, nullable=True),
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('request_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('sequence', sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column('request_revision_id', postgresql.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('request_review_id', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.CheckConstraint("(new_status)::text = ANY ((ARRAY['STARTED'::character varying, 'SUBMITTED'::character varying, 'PENDING_FINANCIAL_VERIFICATION'::character varying, 'PENDING_CCPO_ACCEPTANCE'::character varying, 'PENDING_CCPO_APPROVAL'::character varying, 'CHANGES_REQUESTED'::character varying, 'CHANGES_REQUESTED_TO_FINVER'::character varying, 'APPROVED'::character varying, 'EXPIRED'::character varying, 'DELETED'::character varying])::text[])", name='requeststatus'),
|
||||
sa.ForeignKeyConstraint(['request_id'], ['requests.id'], name='request_status_events_request_id_fkey', ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['request_review_id'], ['request_reviews.id'], name='request_status_events_request_review_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['request_revision_id'], ['request_revisions.id'], name='request_status_events_request_revision_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='request_status_events_pkey')
|
||||
)
|
||||
op.create_foreign_key('workspaces_request_id_fkey', 'portfolios', 'requests', ['request_id'], ['id'])
|
||||
op.create_foreign_key('audit_events_request_id_fkey', 'audit_events', 'requests', ['request_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
@ -1,32 +0,0 @@
|
||||
"""record invitation status
|
||||
|
||||
Revision ID: c98adf9bb431
|
||||
Revises: 1f690989e38e
|
||||
Create Date: 2019-02-06 09:02:28.617202
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c98adf9bb431'
|
||||
down_revision = '1f690989e38e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('cor_invite', sa.Boolean(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_invite', sa.Boolean(), nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_invite', sa.Boolean(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'so_invite')
|
||||
op.drop_column('task_orders', 'ko_invite')
|
||||
op.drop_column('task_orders', 'cor_invite')
|
||||
# ### end Alembic commands ###
|
@ -1,36 +0,0 @@
|
||||
"""add additional user fields
|
||||
|
||||
Revision ID: c99026ab9918
|
||||
Revises: 903d7c66ff1d
|
||||
Create Date: 2018-10-15 11:10:46.073745
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c99026ab9918'
|
||||
down_revision = '903d7c66ff1d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('citizenship', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('date_latest_training', sa.Date(), nullable=True))
|
||||
op.add_column('users', sa.Column('designation', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('phone_number', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('service_branch', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'service_branch')
|
||||
op.drop_column('users', 'phone_number')
|
||||
op.drop_column('users', 'designation')
|
||||
op.drop_column('users', 'date_latest_training')
|
||||
op.drop_column('users', 'citizenship')
|
||||
# ### end Alembic commands ###
|
@ -1,54 +0,0 @@
|
||||
"""environment_roles has relation to application_roles
|
||||
|
||||
Revision ID: d2390c547dca
|
||||
Revises: ab1167fc8260
|
||||
Create Date: 2019-05-29 12:34:45.928219
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd2390c547dca'
|
||||
down_revision = 'ab1167fc8260'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
op.add_column('environment_roles', sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.drop_index('environments_role_user_environment', table_name='environment_roles')
|
||||
op.create_index('environments_role_user_environment', 'environment_roles', ['application_role_id', 'environment_id'], unique=True)
|
||||
op.drop_constraint('environment_roles_user_id_fkey', 'environment_roles', type_='foreignkey')
|
||||
op.create_foreign_key("environment_roles_application_roles_fkey", 'environment_roles', 'application_roles', ['application_role_id'], ['id'])
|
||||
conn.execute("""
|
||||
UPDATE environment_roles er
|
||||
SET application_role_id = application_roles.id
|
||||
FROM environments, applications, application_roles
|
||||
WHERE
|
||||
environment_id = environments.id AND
|
||||
applications.id = environments.application_id AND
|
||||
application_roles.application_id = applications.id AND
|
||||
er.user_id = application_roles.user_id;
|
||||
""")
|
||||
op.alter_column('environment_roles', "application_role_id", nullable=False)
|
||||
op.drop_column('environment_roles', 'user_id')
|
||||
|
||||
|
||||
def downgrade():
|
||||
conn = op.get_bind()
|
||||
op.add_column('environment_roles', sa.Column('user_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.drop_constraint("environment_roles_application_roles_fkey", 'environment_roles', type_='foreignkey')
|
||||
op.create_foreign_key('environment_roles_user_id_fkey', 'environment_roles', 'users', ['user_id'], ['id'])
|
||||
op.drop_index('environments_role_user_environment', table_name='environment_roles')
|
||||
op.create_index('environments_role_user_environment', 'environment_roles', ['user_id', 'environment_id'], unique=True)
|
||||
conn.execute("""
|
||||
UPDATE environment_roles
|
||||
SET user_id = application_roles.user_id
|
||||
FROM application_roles
|
||||
WHERE application_role_id = application_roles.id
|
||||
""")
|
||||
op.alter_column('environment_roles', "user_id", nullable=False)
|
||||
op.drop_column('environment_roles', 'application_role_id')
|
@ -1,132 +0,0 @@
|
||||
"""remove columns from task orders
|
||||
|
||||
Revision ID: d73cba9a4259
|
||||
Revises: d2390c547dca
|
||||
Create Date: 2019-05-30 13:47:08.684986
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd73cba9a4259'
|
||||
down_revision = 'd2390c547dca'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('task_orders_users_so_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_users_ko_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_attachments_csp_attachment_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_users_cor_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_constraint('task_orders_dd_254s_id', 'task_orders', type_='foreignkey')
|
||||
op.drop_column('task_orders', 'custom_clauses')
|
||||
op.drop_column('task_orders', 'unlimited_level_of_warrant')
|
||||
op.drop_column('task_orders', 'complexity_other')
|
||||
op.drop_column('task_orders', 'level_of_warrant')
|
||||
op.drop_column('task_orders', 'ko_id')
|
||||
op.drop_column('task_orders', 'so_first_name')
|
||||
op.drop_column('task_orders', 'ko_invite')
|
||||
op.drop_column('task_orders', 'team_experience')
|
||||
op.drop_column('task_orders', 'so_phone_number')
|
||||
op.drop_column('task_orders', 'cor_phone_number')
|
||||
op.drop_column('task_orders', 'end_date')
|
||||
op.drop_column('task_orders', 'cor_first_name')
|
||||
op.drop_column('task_orders', 'app_migration')
|
||||
op.drop_column('task_orders', 'performance_length')
|
||||
op.drop_column('task_orders', 'ko_last_name')
|
||||
op.drop_column('task_orders', 'so_last_name')
|
||||
op.drop_column('task_orders', 'cor_dod_id')
|
||||
op.drop_column('task_orders', 'scope')
|
||||
op.drop_column('task_orders', 'complexity')
|
||||
op.drop_column('task_orders', 'dev_team_other')
|
||||
op.drop_column('task_orders', 'cor_invite')
|
||||
op.drop_column('task_orders', 'ko_first_name')
|
||||
op.drop_column('task_orders', 'native_apps')
|
||||
op.drop_column('task_orders', 'csp_attachment_id')
|
||||
op.drop_column('task_orders', 'clin_02')
|
||||
op.drop_column('task_orders', 'cor_id')
|
||||
op.drop_column('task_orders', 'so_email')
|
||||
op.drop_column('task_orders', 'ko_email')
|
||||
op.drop_column('task_orders', 'start_date')
|
||||
op.drop_column('task_orders', 'cor_last_name')
|
||||
op.drop_column('task_orders', 'ko_phone_number')
|
||||
op.drop_column('task_orders', 'so_id')
|
||||
op.drop_column('task_orders', 'dev_team')
|
||||
op.drop_column('task_orders', 'clin_01')
|
||||
op.drop_column('task_orders', 'cor_email')
|
||||
op.drop_column('task_orders', 'loas')
|
||||
op.drop_column('task_orders', 'so_dod_id')
|
||||
op.drop_column('task_orders', 'so_invite')
|
||||
op.drop_column('task_orders', 'clin_03')
|
||||
op.drop_column('task_orders', 'dd_254_id')
|
||||
op.drop_column('task_orders', 'clin_04')
|
||||
op.drop_column('task_orders', 'ko_dod_id')
|
||||
op.drop_table('dd_254s')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('ko_dod_id', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('clin_04', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('dd_254_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('clin_03', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_invite', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_dod_id', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('loas', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_email', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('clin_01', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('dev_team', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_phone_number', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_last_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('start_date', sa.DATE(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_email', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_email', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('clin_02', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('csp_attachment_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('native_apps', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_first_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_invite', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('dev_team_other', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('complexity', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('scope', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_dod_id', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_last_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_last_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('performance_length', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('app_migration', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_first_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('end_date', sa.DATE(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('cor_phone_number', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_phone_number', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('team_experience', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_invite', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('so_first_name', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('ko_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('level_of_warrant', sa.NUMERIC(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('complexity_other', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('unlimited_level_of_warrant', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
op.add_column('task_orders', sa.Column('custom_clauses', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
op.create_foreign_key('task_orders_users_cor_id', 'task_orders', 'users', ['cor_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_attachments_csp_attachment_id', 'task_orders', 'attachments', ['csp_attachment_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_users_ko_id', 'task_orders', 'users', ['ko_id'], ['id'])
|
||||
op.create_foreign_key('task_orders_users_so_id', 'task_orders', 'users', ['so_id'], ['id'])
|
||||
op.create_table('dd_254s',
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('certifying_official', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('certifying_official_title', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('certifying_official_address', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('certifying_official_phone', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('required_distribution', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name='dd_254s_pkey')
|
||||
)
|
||||
op.create_foreign_key('task_orders_dd_254s_id', 'task_orders', 'dd_254s', ['dd_254_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
@ -1,25 +0,0 @@
|
||||
"""remove task_orders.number unique constraint
|
||||
|
||||
Revision ID: d966d7194f5c
|
||||
Revises: 3d3c71b03e98
|
||||
Create Date: 2019-06-19 12:53:39.502250
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd966d7194f5c'
|
||||
down_revision = '3d3c71b03e98'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('task_orders_number_key1', 'task_orders', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
# Not downgradeable; would have to determine what redundant TOs to delete
|
@ -1,28 +0,0 @@
|
||||
"""Remove status column from task order
|
||||
|
||||
Revision ID: da9d1c911a52
|
||||
Revises: a6837632686c
|
||||
Create Date: 2019-01-14 11:21:51.729134
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'da9d1c911a52'
|
||||
down_revision = 'a6837632686c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('task_orders', 'status')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('status', sa.VARCHAR(length=7), autoincrement=False, nullable=True))
|
||||
# ### end Alembic commands ###
|
@ -1,30 +0,0 @@
|
||||
"""Update LOA to Array Type
|
||||
|
||||
Revision ID: db161adbafdf
|
||||
Revises: 6512aa8d4641
|
||||
Create Date: 2019-02-15 14:28:33.181136
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'db161adbafdf'
|
||||
down_revision = '6512aa8d4641'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.execute("ALTER TABLE task_orders ALTER COLUMN loa TYPE varchar[] USING array[loa]")
|
||||
op.alter_column('task_orders', 'loa', new_column_name='loas')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.execute("ALTER TABLE task_orders ALTER COLUMN loas TYPE varchar USING loas[1]")
|
||||
op.alter_column('task_orders', 'loas', new_column_name='loa')
|
||||
# ### end Alembic commands ###
|
@ -0,0 +1,345 @@
|
||||
"""reset migrations with new schema
|
||||
|
||||
Revision ID: e0c6eb21771f
|
||||
Revises:
|
||||
Create Date: 2019-06-19 15:17:59.205433
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e0c6eb21771f'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
op.execute("""
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
""")
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('attachments',
|
||||
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('filename', sa.String(), nullable=False),
|
||||
sa.Column('object_name', sa.String(), nullable=False),
|
||||
sa.Column('resource', sa.String(), nullable=True),
|
||||
sa.Column('resource_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('object_name')
|
||||
)
|
||||
op.create_index(op.f('ix_attachments_resource_id'), 'attachments', ['resource_id'], unique=False)
|
||||
op.create_table('notification_recipients',
|
||||
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('email', sa.String(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('permission_sets',
|
||||
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('name', sa.String(), nullable=False),
|
||||
sa.Column('display_name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=False),
|
||||
sa.Column('permissions', postgresql.ARRAY(sa.String()), server_default='{}', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_permission_sets_name'), 'permission_sets', ['name'], unique=True)
|
||||
op.create_index(op.f('ix_permission_sets_permissions'), 'permission_sets', ['permissions'], unique=False)
|
||||
op.create_table('portfolios',
|
||||
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('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=True),
|
||||
sa.Column('defense_component', sa.String(), nullable=True),
|
||||
sa.Column('app_migration', sa.String(), nullable=True),
|
||||
sa.Column('complexity', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column('complexity_other', sa.String(), nullable=True),
|
||||
sa.Column('description', sa.String(), nullable=True),
|
||||
sa.Column('dev_team', sa.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column('dev_team_other', sa.String(), nullable=True),
|
||||
sa.Column('native_apps', sa.String(), nullable=True),
|
||||
sa.Column('team_experience', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('users',
|
||||
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('username', sa.String(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=True),
|
||||
sa.Column('dod_id', sa.String(), nullable=False),
|
||||
sa.Column('first_name', sa.String(), nullable=True),
|
||||
sa.Column('last_name', sa.String(), nullable=True),
|
||||
sa.Column('phone_number', sa.String(), nullable=True),
|
||||
sa.Column('phone_ext', sa.String(), nullable=True),
|
||||
sa.Column('service_branch', sa.String(), nullable=True),
|
||||
sa.Column('citizenship', sa.String(), nullable=True),
|
||||
sa.Column('designation', sa.String(), nullable=True),
|
||||
sa.Column('date_latest_training', sa.Date(), nullable=True),
|
||||
sa.Column('last_login', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.Column('last_session_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('provisional', sa.Boolean(), nullable=True),
|
||||
sa.Column('cloud_id', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('dod_id')
|
||||
)
|
||||
op.create_table('applications',
|
||||
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('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=False),
|
||||
sa.Column('portfolio_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['portfolio_id'], ['portfolios.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('portfolio_roles',
|
||||
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('portfolio_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('status', sa.Enum('ACTIVE', 'DISABLED', 'PENDING', name='status', native_enum=False), nullable=True),
|
||||
sa.ForeignKeyConstraint(['portfolio_id'], ['portfolios.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_portfolio_roles_portfolio_id'), 'portfolio_roles', ['portfolio_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_roles_user_id'), 'portfolio_roles', ['user_id'], unique=False)
|
||||
op.create_index('portfolio_role_user_portfolio', 'portfolio_roles', ['user_id', 'portfolio_id'], unique=True)
|
||||
op.create_table('task_orders',
|
||||
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('portfolio_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('pdf_attachment_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('number', sa.String(), nullable=True),
|
||||
sa.Column('signer_dod_id', sa.String(), nullable=True),
|
||||
sa.Column('signed_at', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['pdf_attachment_id'], ['attachments.id'], ),
|
||||
sa.ForeignKeyConstraint(['portfolio_id'], ['portfolios.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('users_permission_sets',
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('permission_set_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['permission_set_id'], ['permission_sets.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], )
|
||||
)
|
||||
op.create_table('application_roles',
|
||||
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('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('application_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('status', sa.Enum('ACTIVE', 'DISABLED', 'PENDING', name='status', native_enum=False), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_id'], ['applications.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('application_role_user_application', 'application_roles', ['user_id', 'application_id'], unique=True)
|
||||
op.create_index(op.f('ix_application_roles_application_id'), 'application_roles', ['application_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_roles_user_id'), 'application_roles', ['user_id'], unique=False)
|
||||
op.create_table('audit_events',
|
||||
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('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('portfolio_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('application_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('changed_state', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('event_details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('resource_type', sa.String(), nullable=False),
|
||||
sa.Column('resource_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('display_name', sa.String(), nullable=True),
|
||||
sa.Column('action', sa.String(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['application_id'], ['applications.id'], ),
|
||||
sa.ForeignKeyConstraint(['portfolio_id'], ['portfolios.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_audit_events_application_id'), 'audit_events', ['application_id'], unique=False)
|
||||
op.create_index(op.f('ix_audit_events_portfolio_id'), 'audit_events', ['portfolio_id'], unique=False)
|
||||
op.create_index(op.f('ix_audit_events_resource_id'), 'audit_events', ['resource_id'], unique=False)
|
||||
op.create_index(op.f('ix_audit_events_user_id'), 'audit_events', ['user_id'], unique=False)
|
||||
op.create_table('clins',
|
||||
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('task_order_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('number', sa.String(), nullable=True),
|
||||
sa.Column('loas', postgresql.ARRAY(sa.String()), server_default='{}', nullable=True),
|
||||
sa.Column('start_date', sa.Date(), nullable=True),
|
||||
sa.Column('end_date', sa.Date(), nullable=True),
|
||||
sa.Column('obligated_amount', sa.Numeric(scale=2), nullable=True),
|
||||
sa.Column('jedi_clin_type', sa.Enum('JEDI_CLIN_1', 'JEDI_CLIN_2', 'JEDI_CLIN_3', 'JEDI_CLIN_4', name='jediclintype', native_enum=False), nullable=True),
|
||||
sa.ForeignKeyConstraint(['task_order_id'], ['task_orders.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('environments',
|
||||
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('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('application_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('cloud_id', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_id'], ['applications.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('portfolio_invitations',
|
||||
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('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED_WRONG_USER', 'REJECTED_EXPIRED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('expiration_time', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=False),
|
||||
sa.Column('dod_id', sa.String(), nullable=True),
|
||||
sa.Column('first_name', sa.String(), nullable=True),
|
||||
sa.Column('last_name', sa.String(), nullable=True),
|
||||
sa.Column('phone_number', sa.String(), nullable=True),
|
||||
sa.Column('portfolio_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['inviter_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['portfolio_role_id'], ['portfolio_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_portfolio_invitations_inviter_id'), 'portfolio_invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_portfolio_role_id'), 'portfolio_invitations', ['portfolio_role_id'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_token'), 'portfolio_invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_portfolio_invitations_user_id'), 'portfolio_invitations', ['user_id'], unique=False)
|
||||
op.create_table('portfolio_roles_permission_sets',
|
||||
sa.Column('portfolio_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('permission_set_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['permission_set_id'], ['permission_sets.id'], ),
|
||||
sa.ForeignKeyConstraint(['portfolio_role_id'], ['portfolio_roles.id'], )
|
||||
)
|
||||
op.create_table('application_invitations',
|
||||
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('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED_WRONG_USER', 'REJECTED_EXPIRED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('expiration_time', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=False),
|
||||
sa.Column('dod_id', sa.String(), nullable=True),
|
||||
sa.Column('first_name', sa.String(), nullable=True),
|
||||
sa.Column('last_name', sa.String(), nullable=True),
|
||||
sa.Column('phone_number', sa.String(), nullable=True),
|
||||
sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_role_id'], ['application_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['inviter_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_application_invitations_application_role_id'), 'application_invitations', ['application_role_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_inviter_id'), 'application_invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_token'), 'application_invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_application_invitations_user_id'), 'application_invitations', ['user_id'], unique=False)
|
||||
op.create_table('application_roles_permission_sets',
|
||||
sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('permission_set_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['application_role_id'], ['application_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['permission_set_id'], ['permission_sets.id'], )
|
||||
)
|
||||
op.create_table('environment_roles',
|
||||
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('deleted', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('environment_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('role', sa.String(), nullable=True),
|
||||
sa.Column('application_role_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['application_role_id'], ['application_roles.id'], ),
|
||||
sa.ForeignKeyConstraint(['environment_id'], ['environments.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('environments_role_user_environment', 'environment_roles', ['application_role_id', 'environment_id'], unique=True)
|
||||
connection = op.get_bind()
|
||||
connection.execute("""
|
||||
CREATE OR REPLACE FUNCTION lock_dod_id()
|
||||
RETURNS TRIGGER
|
||||
AS $$
|
||||
BEGIN
|
||||
IF NEW.dod_id != OLD.dod_id THEN
|
||||
RAISE EXCEPTION 'DOD ID cannot be updated';
|
||||
END IF;
|
||||
|
||||
RETURN NEW;
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER lock_dod_id
|
||||
BEFORE UPDATE ON users
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE lock_dod_id();
|
||||
""")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('environments_role_user_environment', table_name='environment_roles')
|
||||
op.drop_table('environment_roles')
|
||||
op.drop_table('application_roles_permission_sets')
|
||||
op.drop_index(op.f('ix_application_invitations_user_id'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_token'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_inviter_id'), table_name='application_invitations')
|
||||
op.drop_index(op.f('ix_application_invitations_application_role_id'), table_name='application_invitations')
|
||||
op.drop_table('application_invitations')
|
||||
op.drop_table('portfolio_roles_permission_sets')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_user_id'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_token'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_portfolio_role_id'), table_name='portfolio_invitations')
|
||||
op.drop_index(op.f('ix_portfolio_invitations_inviter_id'), table_name='portfolio_invitations')
|
||||
op.drop_table('portfolio_invitations')
|
||||
op.drop_table('environments')
|
||||
op.drop_table('clins')
|
||||
op.drop_index(op.f('ix_audit_events_user_id'), table_name='audit_events')
|
||||
op.drop_index(op.f('ix_audit_events_resource_id'), table_name='audit_events')
|
||||
op.drop_index(op.f('ix_audit_events_portfolio_id'), table_name='audit_events')
|
||||
op.drop_index(op.f('ix_audit_events_application_id'), table_name='audit_events')
|
||||
op.drop_table('audit_events')
|
||||
op.drop_index(op.f('ix_application_roles_user_id'), table_name='application_roles')
|
||||
op.drop_index(op.f('ix_application_roles_application_id'), table_name='application_roles')
|
||||
op.drop_index('application_role_user_application', table_name='application_roles')
|
||||
op.drop_table('application_roles')
|
||||
op.drop_table('users_permission_sets')
|
||||
op.drop_table('task_orders')
|
||||
op.drop_index('portfolio_role_user_portfolio', table_name='portfolio_roles')
|
||||
op.drop_index(op.f('ix_portfolio_roles_user_id'), table_name='portfolio_roles')
|
||||
op.drop_index(op.f('ix_portfolio_roles_portfolio_id'), table_name='portfolio_roles')
|
||||
op.drop_table('portfolio_roles')
|
||||
op.drop_table('applications')
|
||||
op.drop_table('users')
|
||||
op.drop_table('portfolios')
|
||||
op.drop_index(op.f('ix_permission_sets_permissions'), table_name='permission_sets')
|
||||
op.drop_index(op.f('ix_permission_sets_name'), table_name='permission_sets')
|
||||
op.drop_table('permission_sets')
|
||||
op.drop_table('notification_recipients')
|
||||
op.drop_index(op.f('ix_attachments_resource_id'), table_name='attachments')
|
||||
op.drop_table('attachments')
|
||||
connection = op.get_bind()
|
||||
connection.execute("""
|
||||
DROP TRIGGER IF EXISTS lock_dod_id ON users;
|
||||
DROP FUNCTION IF EXISTS lock_dod_id();
|
||||
""")
|
||||
# ### end Alembic commands ###
|
@ -1,28 +0,0 @@
|
||||
"""add status to workspace_roles
|
||||
|
||||
Revision ID: e0fc3cd315c1
|
||||
Revises: 994a80ee92c9
|
||||
Create Date: 2018-10-30 14:36:51.047876
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e0fc3cd315c1'
|
||||
down_revision = '994a80ee92c9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('workspace_roles', sa.Column('status', sa.Enum('ACTIVE', 'DISABLED', 'PENDING', name='status', native_enum=False), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('workspace_roles', 'status')
|
||||
# ### end Alembic commands ###
|
@ -1,44 +0,0 @@
|
||||
"""adjust invitation status
|
||||
|
||||
Revision ID: e1081cf01780
|
||||
Revises: a9d8c6b6221c
|
||||
Create Date: 2018-11-01 12:24:10.970963
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from enum import Enum
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e1081cf01780'
|
||||
down_revision = 'a9d8c6b6221c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
class Status(Enum):
|
||||
ACCEPTED = "accepted"
|
||||
REVOKED = "revoked"
|
||||
PENDING = "pending"
|
||||
REJECTED_WRONG_USER = "rejected_wrong_user"
|
||||
REJECTED_EXPIRED = "rejected_expired"
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
constraints = ", ".join(["'{}'::character varying::text".format(s.name) for s in Status])
|
||||
conn.execute("ALTER TABLE invitations ALTER COLUMN status TYPE varchar(30)")
|
||||
conn.execute("ALTER TABLE invitations DROP CONSTRAINT status")
|
||||
conn.execute("ALTER TABLE invitations ADD CONSTRAINT status CHECK(status::text = ANY (ARRAY[{}]))".format(constraints))
|
||||
|
||||
class PreviousStatus(Enum):
|
||||
ACCEPTED = "accepted"
|
||||
REVOKED = "revoked"
|
||||
PENDING = "pending"
|
||||
REJECTED = "rejected"
|
||||
|
||||
def downgrade():
|
||||
conn = op.get_bind()
|
||||
constraints = ", ".join(["'{}'::character varying::text".format(s.name) for s in PreviousStatus])
|
||||
conn.execute("ALTER TABLE invitations ALTER COLUMN status TYPE varchar(8)")
|
||||
conn.execute("ALTER TABLE invitations DROP CONSTRAINT status")
|
||||
conn.execute("ALTER TABLE invitations ADD CONSTRAINT status CHECK(status::text = ANY (ARRAY[{}]))".format(constraints))
|
@ -1,32 +0,0 @@
|
||||
"""make user_id nullable for request_review
|
||||
|
||||
Revision ID: ea8b5681b37c
|
||||
Revises: e1081cf01780
|
||||
Create Date: 2018-11-05 14:42:42.175939
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ea8b5681b37c'
|
||||
down_revision = 'e1081cf01780'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('request_reviews', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('request_reviews', 'user_id',
|
||||
existing_type=postgresql.UUID(),
|
||||
nullable=False)
|
||||
# ### end Alembic commands ###
|
@ -1,52 +0,0 @@
|
||||
"""Move defense component to Portfolio level
|
||||
|
||||
Revision ID: ec1ba2363191
|
||||
Revises: fb22e47972a3
|
||||
Create Date: 2019-02-22 14:43:49.408446
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ec1ba2363191'
|
||||
down_revision = 'fb22e47972a3'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('portfolios', sa.Column('defense_component', sa.String(), nullable=True))
|
||||
conn = op.get_bind()
|
||||
conn.execute(
|
||||
text(
|
||||
"""
|
||||
UPDATE portfolios
|
||||
SET defense_component = task_orders.defense_component
|
||||
FROM task_orders
|
||||
WHERE task_orders.portfolio_id = portfolios.id;
|
||||
"""
|
||||
)
|
||||
)
|
||||
op.drop_column('task_orders', 'defense_component')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_orders', sa.Column('defense_component', sa.VARCHAR(), autoincrement=False, nullable=True))
|
||||
conn = op.get_bind()
|
||||
conn.execute(
|
||||
text(
|
||||
"""
|
||||
UPDATE task_orders
|
||||
SET defense_component = portfolios.defense_component
|
||||
FROM portfolios;
|
||||
"""
|
||||
)
|
||||
)
|
||||
op.drop_column('portfolios', 'defense_component')
|
||||
# ### end Alembic commands ###
|
@ -1,27 +0,0 @@
|
||||
"""full prefix for certifying official on dd 254
|
||||
|
||||
Revision ID: fa3ba4049218
|
||||
Revises: 7d9f070012ae
|
||||
Create Date: 2019-02-20 11:19:39.655438
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'fa3ba4049218'
|
||||
down_revision = '7d9f070012ae'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column("dd_254s", "co_address", new_column_name="certifying_official_address")
|
||||
op.alter_column("dd_254s", "co_phone", new_column_name="certifying_official_phone")
|
||||
op.alter_column("dd_254s", "co_title", new_column_name="certifying_official_title")
|
||||
|
||||
def downgrade():
|
||||
op.alter_column("dd_254s", "certifying_official_address", new_column_name="co_address")
|
||||
op.alter_column("dd_254s", "certifying_official_phone", new_column_name="co_phone")
|
||||
op.alter_column("dd_254s", "certifying_official_title", new_column_name="co_title")
|
@ -1,49 +0,0 @@
|
||||
"""Remove legacy task order table
|
||||
|
||||
Revision ID: fb22e47972a3
|
||||
Revises: 978bf56e21b6
|
||||
Create Date: 2019-02-20 18:28:56.386152
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'fb22e47972a3'
|
||||
down_revision = '978bf56e21b6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('legacy_task_orders')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('legacy_task_orders',
|
||||
sa.Column('time_created', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('time_updated', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
|
||||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
|
||||
sa.Column('number', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('source', sa.VARCHAR(length=6), autoincrement=False, nullable=True),
|
||||
sa.Column('funding_type', sa.VARCHAR(length=5), autoincrement=False, nullable=True),
|
||||
sa.Column('funding_type_other', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_0001', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_0003', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_1001', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_1003', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_2001', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('clin_2003', sa.INTEGER(), autoincrement=False, nullable=True),
|
||||
sa.Column('expiration_date', sa.DATE(), autoincrement=False, nullable=True),
|
||||
sa.Column('attachment_id', postgresql.UUID(), autoincrement=False, nullable=True),
|
||||
sa.CheckConstraint("(funding_type)::text = ANY ((ARRAY['RDTE'::character varying, 'OM'::character varying, 'PROC'::character varying, 'OTHER'::character varying])::text[])", name='fundingtype'),
|
||||
sa.CheckConstraint("(source)::text = ANY ((ARRAY['MANUAL'::character varying, 'EDA'::character varying])::text[])", name='source'),
|
||||
sa.ForeignKeyConstraint(['attachment_id'], ['attachments.id'], name='task_orders_attachment_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='task_orders_pkey'),
|
||||
sa.UniqueConstraint('number', name='task_orders_number_key')
|
||||
)
|
||||
# ### end Alembic commands ###
|
@ -1,37 +0,0 @@
|
||||
"""users to permission_sets join table, remove role rel
|
||||
|
||||
Revision ID: fc08d99bb7f7
|
||||
Revises: a19138e386c4
|
||||
Create Date: 2019-03-18 06:13:43.128905
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'fc08d99bb7f7'
|
||||
down_revision = 'a19138e386c4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('users_permission_sets',
|
||||
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('permission_set_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['permission_set_id'], ['permission_sets.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], )
|
||||
)
|
||||
op.drop_constraint('users_atat_role_id_fkey', 'users', type_='foreignkey')
|
||||
op.drop_column('users', 'atat_role_id')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('atat_role_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.create_foreign_key('users_atat_role_id_fkey', 'users', 'permission_sets', ['atat_role_id'], ['id'])
|
||||
op.drop_table('users_permission_sets')
|
||||
# ### end Alembic commands ###
|
Loading…
x
Reference in New Issue
Block a user