mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Add API functionality
This commit is contained in:
		
							
								
								
									
										41
									
								
								migrations/versions/116b4ab3ef9c_.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								migrations/versions/116b4ab3ef9c_.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
"""Add API authentication token table
 | 
			
		||||
 | 
			
		||||
Revision ID: 116b4ab3ef9c
 | 
			
		||||
Revises: f9070ff1fa4a
 | 
			
		||||
Create Date: 2022-09-02 11:12:01.995451
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
from alembic import op
 | 
			
		||||
import sqlalchemy as sa
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# revision identifiers, used by Alembic.
 | 
			
		||||
revision = '116b4ab3ef9c'
 | 
			
		||||
down_revision = 'f9070ff1fa4a'
 | 
			
		||||
branch_labels = None
 | 
			
		||||
depends_on = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def upgrade():
 | 
			
		||||
    # ### commands auto generated by Alembic - please adjust! ###
 | 
			
		||||
    op.create_table('tokens',
 | 
			
		||||
    sa.Column('id', sa.Integer(), nullable=False),
 | 
			
		||||
    sa.Column('user_id', sa.Integer(), nullable=True),
 | 
			
		||||
    sa.Column('access_token', sa.String(length=64), nullable=True),
 | 
			
		||||
    sa.Column('access_expiration', sa.DateTime(), nullable=True),
 | 
			
		||||
    sa.Column('refresh_token', sa.String(length=64), nullable=True),
 | 
			
		||||
    sa.Column('refresh_expiration', sa.DateTime(), nullable=True),
 | 
			
		||||
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
 | 
			
		||||
    sa.PrimaryKeyConstraint('id')
 | 
			
		||||
    )
 | 
			
		||||
    op.create_index(op.f('ix_tokens_access_token'), 'tokens', ['access_token'], unique=False)
 | 
			
		||||
    op.create_index(op.f('ix_tokens_refresh_token'), 'tokens', ['refresh_token'], unique=False)
 | 
			
		||||
    # ### end Alembic commands ###
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def downgrade():
 | 
			
		||||
    # ### commands auto generated by Alembic - please adjust! ###
 | 
			
		||||
    op.drop_index(op.f('ix_tokens_refresh_token'), table_name='tokens')
 | 
			
		||||
    op.drop_index(op.f('ix_tokens_access_token'), table_name='tokens')
 | 
			
		||||
    op.drop_table('tokens')
 | 
			
		||||
    # ### end Alembic commands ###
 | 
			
		||||
		Reference in New Issue
	
	Block a user