58 lines
2 KiB
Python
58 lines
2 KiB
Python
"""remove onion key column
|
|
|
|
Revision ID: 6a59928efeb7
|
|
Revises: c4ce00f86823
|
|
Create Date: 2022-11-09 15:16:10.116405
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '6a59928efeb7'
|
|
down_revision = 'c4ce00f86823'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('onion', schema=None) as batch_op:
|
|
batch_op.alter_column('onion_public_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=False)
|
|
batch_op.alter_column('onion_private_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=False)
|
|
batch_op.alter_column('tls_public_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=False)
|
|
batch_op.alter_column('tls_private_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=False)
|
|
batch_op.drop_constraint('uq_onion_onion_name', type_='unique')
|
|
batch_op.drop_column('onion_name')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('onion', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('onion_name', sa.VARCHAR(length=56), autoincrement=False, nullable=False))
|
|
batch_op.create_unique_constraint('uq_onion_onion_name', ['onion_name'])
|
|
batch_op.alter_column('tls_private_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=True)
|
|
batch_op.alter_column('tls_public_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=True)
|
|
batch_op.alter_column('onion_private_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=True)
|
|
batch_op.alter_column('onion_public_key',
|
|
existing_type=postgresql.BYTEA(),
|
|
nullable=True)
|
|
|
|
# ### end Alembic commands ###
|