Created endpoints for create and delete token.

This commit is contained in:
Rebecca Law
2016-01-13 14:05:49 +00:00
parent 3a3f9becec
commit 725b976d31
10 changed files with 210 additions and 34 deletions

View File

@@ -0,0 +1,36 @@
"""empty message
Revision ID: 0002_create_api_token
Revises: 0001_initialise_data
Create Date: 2016-01-13 10:21:14.651691
"""
# revision identifiers, used by Alembic.
revision = '0002_create_api_token'
down_revision = '0001_initialise_data'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('tokens',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('token', sa.String(), 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('token')
)
op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
op.drop_table('tokens')
### end Alembic commands ###