mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0022_add_invite_users
|
|
Revises: 0021_add_job_metadata
|
|
Create Date: 2016-02-23 16:41:40.481468
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0022_add_invite_users'
|
|
down_revision = '0021_add_job_metadata'
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
def upgrade():
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('invited_users',
|
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('email_address', sa.String(length=255), nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=True),
|
|
sa.Column('_token', sa.String(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
sa.Column('status', sa.Enum('pending', 'accepted', 'cancelled', name='invited_users_status_types'), nullable=False),
|
|
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
|
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_invited_users_service_id'), 'invited_users', ['service_id'], unique=False)
|
|
op.create_index(op.f('ix_invited_users_user_id'), 'invited_users', ['user_id'], unique=False)
|
|
### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_invited_users_user_id'), table_name='invited_users')
|
|
op.drop_index(op.f('ix_invited_users_service_id'), table_name='invited_users')
|
|
op.drop_table('invited_users')
|
|
op.execute('DROP TYPE invited_users_status_types')
|
|
### end Alembic commands ###
|