Add tracking of the kind of temporary access tokens, so we can display if a pull/push by token is for a build worker
This commit is contained in:
parent
3e04e3cfd7
commit
83e05d2342
10 changed files with 88 additions and 14 deletions
|
@ -0,0 +1,44 @@
|
|||
"""Add access token kinds type
|
||||
|
||||
Revision ID: 3e2d38b52a75
|
||||
Revises: 1d2d86d09fcd
|
||||
Create Date: 2015-02-17 12:03:26.422485
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3e2d38b52a75'
|
||||
down_revision = '1d2d86d09fcd'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('accesstokenkind',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_accesstokenkind'))
|
||||
)
|
||||
op.create_index('accesstokenkind_name', 'accesstokenkind', ['name'], unique=True)
|
||||
op.add_column(u'accesstoken', sa.Column('kind_id', sa.Integer(), nullable=True))
|
||||
op.create_index('accesstoken_kind_id', 'accesstoken', ['kind_id'], unique=False)
|
||||
op.create_foreign_key(op.f('fk_accesstoken_kind_id_accesstokenkind'), 'accesstoken', 'accesstokenkind', ['kind_id'], ['id'])
|
||||
### end Alembic commands ###
|
||||
|
||||
op.bulk_insert(tables.accesstokenkind,
|
||||
[
|
||||
{'id': 1, 'name':'build-worker'},
|
||||
{'id': 2, 'name':'pushpull-token'},
|
||||
])
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(op.f('fk_accesstoken_kind_id_accesstokenkind'), 'accesstoken', type_='foreignkey')
|
||||
op.drop_index('accesstoken_kind_id', table_name='accesstoken')
|
||||
op.drop_column(u'accesstoken', 'kind_id')
|
||||
op.drop_index('accesstokenkind_name', table_name='accesstokenkind')
|
||||
op.drop_table('accesstokenkind')
|
||||
### end Alembic commands ###
|
Reference in a new issue