mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0007_change_to_api_keys
|
|
Revises: 0005_add_job_details
|
|
Create Date: 2016-01-19 10:50:46.269618
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0007_change_to_api_keys'
|
|
down_revision = '0006_add_user_details'
|
|
|
|
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('api_key',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=255), nullable=False),
|
|
sa.Column('secret', sa.String(length=255), nullable=False),
|
|
sa.Column('service_id', sa.Integer(), nullable=False),
|
|
sa.Column('expiry_date', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('secret')
|
|
)
|
|
op.create_index(op.f('ix_api_key_service_id'), 'api_key', ['service_id'], unique=False)
|
|
op.drop_table('tokens')
|
|
### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('tokens',
|
|
sa.Column('id', sa.INTEGER(), nullable=False),
|
|
sa.Column('token', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
|
sa.Column('service_id', sa.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('expiry_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
|
sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='tokens_service_id_fkey'),
|
|
sa.PrimaryKeyConstraint('id', name='tokens_pkey'),
|
|
sa.UniqueConstraint('token', name='tokens_token_key')
|
|
)
|
|
op.drop_index(op.f('ix_api_key_service_id'), table_name='api_key')
|
|
op.drop_table('api_key')
|
|
### end Alembic commands ###
|