mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-28 14:05:41 +00:00
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
|
"""add apikey account mapping table
|
||
|
|
||
|
Revision ID: 0967658d9c0d
|
||
|
Revises: 0d3d93f1c2e0
|
||
|
Create Date: 2021-11-13 22:28:46.133474
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '0967658d9c0d'
|
||
|
down_revision = '0d3d93f1c2e0'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('apikey_account',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('apikey_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('account_id', sa.Integer(), nullable=False),
|
||
|
sa.ForeignKeyConstraint(['account_id'], ['account.id'], ),
|
||
|
sa.ForeignKeyConstraint(['apikey_id'], ['apikey.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
with op.batch_alter_table('history', schema=None) as batch_op:
|
||
|
batch_op.create_index(batch_op.f('ix_history_created_on'), ['created_on'], unique=False)
|
||
|
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
with op.batch_alter_table('history', schema=None) as batch_op:
|
||
|
batch_op.drop_index(batch_op.f('ix_history_created_on'))
|
||
|
|
||
|
op.drop_table('apikey_account')
|
||
|
# ### end Alembic commands ###
|