db: truncate alembic migration history
This commit is contained in:
parent
7f9b3b9b64
commit
25bbdf8e2b
23 changed files with 253 additions and 1046 deletions
|
@ -1,124 +0,0 @@
|
|||
"""initial schema
|
||||
|
||||
Revision ID: 07c4fb2af22c
|
||||
Revises:
|
||||
Create Date: 2022-03-31 12:36:02.922753
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '07c4fb2af22c'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('group',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_name', sa.String(length=80), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('eotk', sa.Boolean(), nullable=True),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_group')),
|
||||
sa.UniqueConstraint('group_name', name=op.f('uq_group_group_name'))
|
||||
)
|
||||
op.create_table('bridge_conf',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('method', sa.String(length=20), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.Column('number', sa.Integer(), nullable=True),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_bridge_conf_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_bridge_conf'))
|
||||
)
|
||||
op.create_table('origin',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_origin_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_origin')),
|
||||
sa.UniqueConstraint('domain_name', name=op.f('uq_origin_domain_name'))
|
||||
)
|
||||
op.create_table('bridge',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('conf_id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('terraform_updated', sa.DateTime(), nullable=True),
|
||||
sa.Column('fingerprint', sa.String(length=255), nullable=True),
|
||||
sa.Column('hashed_fingerprint', sa.String(length=255), nullable=True),
|
||||
sa.Column('bridgeline', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['conf_id'], ['bridge_conf.id'], name=op.f('fk_bridge_conf_id_bridge_conf')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_bridge'))
|
||||
)
|
||||
op.create_table('mirror',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('origin_id', sa.Integer(), nullable=False),
|
||||
sa.Column('url', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], name=op.f('fk_mirror_origin_id_origin')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_mirror')),
|
||||
sa.UniqueConstraint('url', name=op.f('uq_mirror_url'))
|
||||
)
|
||||
op.create_table('proxy',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('origin_id', sa.Integer(), nullable=False),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('slug', sa.String(length=20), nullable=True),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('terraform_updated', sa.DateTime(), nullable=True),
|
||||
sa.Column('url', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], name=op.f('fk_proxy_origin_id_origin')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_proxy'))
|
||||
)
|
||||
op.create_table('alarm',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('target', sa.String(length=60), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=True),
|
||||
sa.Column('origin_id', sa.Integer(), nullable=True),
|
||||
sa.Column('proxy_id', sa.Integer(), nullable=True),
|
||||
sa.Column('bridge_id', sa.Integer(), nullable=True),
|
||||
sa.Column('alarm_type', sa.String(length=255), nullable=False),
|
||||
sa.Column('alarm_state', sa.Enum('UNKNOWN', 'OK', 'WARNING', 'CRITICAL', name='alarmstate'), nullable=False),
|
||||
sa.Column('state_changed', sa.DateTime(), nullable=False),
|
||||
sa.Column('last_updated', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['bridge_id'], ['bridge.id'], name=op.f('fk_alarm_bridge_id_bridge')),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_alarm_group_id_group')),
|
||||
sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], name=op.f('fk_alarm_origin_id_origin')),
|
||||
sa.ForeignKeyConstraint(['proxy_id'], ['proxy.id'], name=op.f('fk_alarm_proxy_id_proxy')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_alarm'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('alarm')
|
||||
op.drop_table('proxy')
|
||||
op.drop_table('mirror')
|
||||
op.drop_table('bridge')
|
||||
op.drop_table('origin')
|
||||
op.drop_table('bridge_conf')
|
||||
op.drop_table('group')
|
||||
# ### end Alembic commands ###
|
|
@ -1,54 +0,0 @@
|
|||
"""add automations
|
||||
|
||||
Revision ID: 0a0a65db7f01
|
||||
Revises: c3d6e95caa79
|
||||
Create Date: 2022-05-08 16:24:53.779353
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0a0a65db7f01'
|
||||
down_revision = 'c3d6e95caa79'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('automation',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('short_name', sa.String(length=25), nullable=False),
|
||||
sa.Column('state', sa.Enum('IDLE', 'RUNNING', 'ERROR', name='automationstate'), nullable=False),
|
||||
sa.Column('enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('last_run', sa.DateTime(), nullable=True),
|
||||
sa.Column('next_run', sa.DateTime(), nullable=True),
|
||||
sa.Column('next_is_full', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_automation'))
|
||||
)
|
||||
op.create_table('automation_logs',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('automation_id', sa.Integer(), nullable=False),
|
||||
sa.Column('logs', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['automation_id'], ['automation.id'], name=op.f('fk_automation_logs_automation_id_automation')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_automation_logs'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('automation_logs')
|
||||
op.drop_table('automation')
|
||||
# ### end Alembic commands ###
|
|
@ -1,50 +0,0 @@
|
|||
"""add smart proxies
|
||||
|
||||
Revision ID: 133961a48525
|
||||
Revises: 31aec2f86c40
|
||||
Create Date: 2022-05-24 14:56:43.071054
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '133961a48525'
|
||||
down_revision = '31aec2f86c40'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('smart_proxy',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=100), nullable=True),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('region', sa.String(length=20), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_smart_proxy_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_smart_proxy'))
|
||||
)
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('smart', sa.Boolean(), nullable=True))
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.execute("UPDATE origin SET smart=FALSE")
|
||||
batch_op.alter_column(sa.Column('smart', sa.Boolean(), nullable=False))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.drop_column('smart')
|
||||
|
||||
op.drop_table('smart_proxy')
|
||||
# ### end Alembic commands ###
|
|
@ -1,40 +0,0 @@
|
|||
"""drop mirror table
|
||||
|
||||
Revision ID: 1842ba85a5c7
|
||||
Revises: 9f5525e84960
|
||||
Create Date: 2022-05-17 09:28:13.172061
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1842ba85a5c7'
|
||||
down_revision = '9f5525e84960'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('mirror')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('mirror',
|
||||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
||||
sa.Column('origin_id', sa.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.Column('url', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
|
||||
sa.Column('added', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('deprecated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||||
sa.Column('destroyed', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||||
sa.Column('deprecation_reason', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], name='fk_mirror_origin_id_origin'),
|
||||
sa.PrimaryKeyConstraint('id', name='pk_mirror'),
|
||||
sa.UniqueConstraint('url', name='uq_mirror_url')
|
||||
)
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""add provider subgroup to proxy
|
||||
|
||||
Revision ID: 22a33ecf3474
|
||||
Revises: 25092034e059
|
||||
Create Date: 2022-04-25 13:33:21.231392
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '22a33ecf3474'
|
||||
down_revision = '25092034e059'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('psg', sa.Integer(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.drop_column('psg')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""no_list_deprecation
|
||||
|
||||
Revision ID: 25092034e059
|
||||
Revises: c83bdf6bf959
|
||||
Create Date: 2022-04-22 14:02:50.709644
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '25092034e059'
|
||||
down_revision = 'c83bdf6bf959'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.drop_column('deprecated')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('deprecated', sa.DATETIME(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,63 +0,0 @@
|
|||
"""new alarm schema
|
||||
|
||||
Revision ID: 31aec2f86c40
|
||||
Revises: 1842ba85a5c7
|
||||
Create Date: 2022-05-18 14:22:51.028405
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '31aec2f86c40'
|
||||
down_revision = '1842ba85a5c7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('alarm', schema=None) as batch_op:
|
||||
batch_op.execute("TRUNCATE alarm")
|
||||
batch_op.add_column(sa.Column('aspect', sa.String(length=255), nullable=False))
|
||||
batch_op.alter_column('last_updated',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=False)
|
||||
batch_op.alter_column('text',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
batch_op.drop_constraint('fk_alarm_group_id_group', type_='foreignkey')
|
||||
batch_op.drop_constraint('fk_alarm_proxy_id_proxy', type_='foreignkey')
|
||||
batch_op.drop_constraint('fk_alarm_origin_id_origin', type_='foreignkey')
|
||||
batch_op.drop_constraint('fk_alarm_bridge_id_bridge', type_='foreignkey')
|
||||
batch_op.drop_column('origin_id')
|
||||
batch_op.drop_column('alarm_type')
|
||||
batch_op.drop_column('bridge_id')
|
||||
batch_op.drop_column('group_id')
|
||||
batch_op.drop_column('proxy_id')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('alarm', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('proxy_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('group_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('bridge_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('alarm_type', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
|
||||
batch_op.add_column(sa.Column('origin_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
||||
batch_op.create_foreign_key('fk_alarm_bridge_id_bridge', 'bridge', ['bridge_id'], ['id'])
|
||||
batch_op.create_foreign_key('fk_alarm_origin_id_origin', 'origin', ['origin_id'], ['id'])
|
||||
batch_op.create_foreign_key('fk_alarm_proxy_id_proxy', 'proxy', ['proxy_id'], ['id'])
|
||||
batch_op.create_foreign_key('fk_alarm_group_id_group', 'group', ['group_id'], ['id'])
|
||||
batch_op.alter_column('text',
|
||||
existing_type=sa.VARCHAR(length=255),
|
||||
nullable=True)
|
||||
batch_op.alter_column('last_updated',
|
||||
existing_type=postgresql.TIMESTAMP(),
|
||||
nullable=True)
|
||||
batch_op.drop_column('aspect')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,61 +0,0 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 45fedef32318
|
||||
Revises: 665e340dbe09
|
||||
Create Date: 2022-09-07 16:20:04.603554
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '45fedef32318'
|
||||
down_revision = '665e340dbe09'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('pool',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('pool_name', sa.String(length=80), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_pool')),
|
||||
sa.UniqueConstraint('pool_name', name=op.f('uq_pool_pool_name'))
|
||||
)
|
||||
op.create_table('pool_group',
|
||||
sa.Column('pool_id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_pool_group_group_id_group')),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pool.id'], name=op.f('fk_pool_group_pool_id_pool')),
|
||||
sa.PrimaryKeyConstraint('pool_id', 'group_id', name=op.f('pk_pool_group'))
|
||||
)
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('pool_id', sa.Integer(), nullable=True))
|
||||
batch_op.create_foreign_key(batch_op.f('fk_mirror_list_pool_id_pool'), 'pool', ['pool_id'], ['id'])
|
||||
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('pool_id', sa.Integer(), nullable=True))
|
||||
batch_op.create_foreign_key(batch_op.f('fk_proxy_pool_id_pool'), 'pool', ['pool_id'], ['id'])
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('fk_proxy_pool_id_pool'), type_='foreignkey')
|
||||
batch_op.drop_column('pool_id')
|
||||
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('fk_mirror_list_pool_id_pool'), type_='foreignkey')
|
||||
batch_op.drop_column('pool_id')
|
||||
|
||||
op.drop_table('pool_group')
|
||||
op.drop_table('pool')
|
||||
# ### end Alembic commands ###
|
|
@ -1,54 +0,0 @@
|
|||
"""record deprecation reason
|
||||
|
||||
Revision ID: 56fbcfa1138c
|
||||
Revises: 22a33ecf3474
|
||||
Create Date: 2022-05-01 16:13:03.425508
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '56fbcfa1138c'
|
||||
down_revision = '22a33ecf3474'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('bridge', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
|
||||
|
||||
with op.batch_alter_table('mirror', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
|
||||
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('auto_rotation', sa.Boolean(), nullable=True))
|
||||
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.execute("UPDATE origin SET auto_rotation = true")
|
||||
batch_op.alter_column('auto_rotation', nullable=False)
|
||||
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('proxy', schema=None) as batch_op:
|
||||
batch_op.drop_column('deprecation_reason')
|
||||
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.drop_column('auto_rotation')
|
||||
|
||||
with op.batch_alter_table('mirror', schema=None) as batch_op:
|
||||
batch_op.drop_column('deprecation_reason')
|
||||
|
||||
with op.batch_alter_table('bridge', schema=None) as batch_op:
|
||||
batch_op.drop_column('deprecation_reason')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,38 +0,0 @@
|
|||
"""alarms text and destroy origins
|
||||
|
||||
Revision ID: 59c9a5185e88
|
||||
Revises: 5c69fe874e4d
|
||||
Create Date: 2022-04-07 16:30:27.888327
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '59c9a5185e88'
|
||||
down_revision = '5c69fe874e4d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('alarm', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('text', sa.String(length=255), nullable=True))
|
||||
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('destroyed', sa.DateTime(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.drop_column('destroyed')
|
||||
|
||||
with op.batch_alter_table('alarm', schema=None) as batch_op:
|
||||
batch_op.drop_column('text')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""add bridge nicknames
|
||||
|
||||
Revision ID: 5c69fe874e4d
|
||||
Revises: e1332e4cb910
|
||||
Create Date: 2022-04-05 15:48:36.552558
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5c69fe874e4d'
|
||||
down_revision = 'e1332e4cb910'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('bridge', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('nickname', sa.String(length=255), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('bridge', schema=None) as batch_op:
|
||||
batch_op.drop_column('nickname')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,28 +0,0 @@
|
|||
"""add terraform state
|
||||
|
||||
Revision ID: 665e340dbe09
|
||||
Revises: c644bb20d0e3
|
||||
Create Date: 2022-08-29 17:10:05.447985
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '665e340dbe09'
|
||||
down_revision = 'c644bb20d0e3'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('terraform_state',
|
||||
sa.Column('key', sa.String(), nullable=False),
|
||||
sa.Column('state', sa.String(), nullable=True),
|
||||
sa.Column('lock', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('key', name=op.f('pk_terraform_state'))
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('terraform_state')
|
253
migrations/versions/6a59928efeb7_initial_schema.py
Normal file
253
migrations/versions/6a59928efeb7_initial_schema.py
Normal file
|
@ -0,0 +1,253 @@
|
|||
"""initial schema
|
||||
|
||||
Revision ID: 6a59928efeb7
|
||||
Revises:
|
||||
Create Date: 2022-11-13 19:03:10.787978
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6a59928efeb7'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('activity',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=True),
|
||||
sa.Column('activity_type', sa.String(length=20), nullable=False),
|
||||
sa.Column('text', sa.Text(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_activity'))
|
||||
)
|
||||
op.create_table('alarm',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('target', sa.String(length=255), nullable=False),
|
||||
sa.Column('aspect', sa.String(length=255), nullable=False),
|
||||
sa.Column('alarm_state', sa.Enum('UNKNOWN', 'OK', 'WARNING', 'CRITICAL', name='alarmstate'), nullable=False),
|
||||
sa.Column('state_changed', sa.DateTime(), nullable=False),
|
||||
sa.Column('last_updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('text', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_alarm'))
|
||||
)
|
||||
op.create_table('automation',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('short_name', sa.String(length=25), nullable=False),
|
||||
sa.Column('state', sa.Enum('IDLE', 'RUNNING', 'ERROR', name='automationstate'), nullable=False),
|
||||
sa.Column('enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('last_run', sa.DateTime(), nullable=True),
|
||||
sa.Column('next_run', sa.DateTime(), nullable=True),
|
||||
sa.Column('next_is_full', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_automation'))
|
||||
)
|
||||
op.create_table('group',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_name', sa.String(length=80), nullable=False),
|
||||
sa.Column('eotk', sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_group')),
|
||||
sa.UniqueConstraint('group_name', name=op.f('uq_group_group_name'))
|
||||
)
|
||||
op.create_table('pool',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('pool_name', sa.String(length=80), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_pool')),
|
||||
sa.UniqueConstraint('pool_name', name=op.f('uq_pool_pool_name'))
|
||||
)
|
||||
op.create_table('terraform_state',
|
||||
sa.Column('key', sa.String(), nullable=False),
|
||||
sa.Column('state', sa.String(), nullable=True),
|
||||
sa.Column('lock', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('key', name=op.f('pk_terraform_state'))
|
||||
)
|
||||
op.create_table('webhook',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('format', sa.String(length=20), nullable=True),
|
||||
sa.Column('url', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_webhook'))
|
||||
)
|
||||
op.create_table('automation_logs',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('automation_id', sa.Integer(), nullable=False),
|
||||
sa.Column('logs', sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['automation_id'], ['automation.id'], name=op.f('fk_automation_logs_automation_id_automation')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_automation_logs'))
|
||||
)
|
||||
op.create_table('bridge_conf',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('method', sa.String(length=20), nullable=False),
|
||||
sa.Column('number', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_bridge_conf_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_bridge_conf'))
|
||||
)
|
||||
op.create_table('eotk',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=100), nullable=True),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('region', sa.String(length=20), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_eotk_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_eotk'))
|
||||
)
|
||||
op.create_table('mirror_list',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('pool_id', sa.Integer(), nullable=True),
|
||||
sa.Column('provider', sa.String(length=255), nullable=False),
|
||||
sa.Column('format', sa.String(length=20), nullable=False),
|
||||
sa.Column('encoding', sa.String(length=20), nullable=False),
|
||||
sa.Column('container', sa.String(length=255), nullable=False),
|
||||
sa.Column('branch', sa.String(length=255), nullable=False),
|
||||
sa.Column('role', sa.String(length=255), nullable=True),
|
||||
sa.Column('filename', sa.String(length=255), nullable=False),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pool.id'], name=op.f('fk_mirror_list_pool_id_pool')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_mirror_list'))
|
||||
)
|
||||
op.create_table('onion',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('onion_public_key', sa.LargeBinary(), nullable=False),
|
||||
sa.Column('onion_private_key', sa.LargeBinary(), nullable=False),
|
||||
sa.Column('tls_public_key', sa.LargeBinary(), nullable=False),
|
||||
sa.Column('tls_private_key', sa.LargeBinary(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_onion_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_onion'))
|
||||
)
|
||||
op.create_table('origin',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('auto_rotation', sa.Boolean(), nullable=False),
|
||||
sa.Column('smart', sa.Boolean(), nullable=False),
|
||||
sa.Column('assets', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_origin_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_origin')),
|
||||
sa.UniqueConstraint('domain_name', name=op.f('uq_origin_domain_name'))
|
||||
)
|
||||
op.create_table('pool_group',
|
||||
sa.Column('pool_id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_pool_group_group_id_group')),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pool.id'], name=op.f('fk_pool_group_pool_id_pool')),
|
||||
sa.PrimaryKeyConstraint('pool_id', 'group_id', name=op.f('pk_pool_group'))
|
||||
)
|
||||
op.create_table('smart_proxy',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=100), nullable=True),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('region', sa.String(length=20), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_smart_proxy_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_smart_proxy'))
|
||||
)
|
||||
op.create_table('bridge',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('conf_id', sa.Integer(), nullable=False),
|
||||
sa.Column('terraform_updated', sa.DateTime(), nullable=True),
|
||||
sa.Column('nickname', sa.String(length=255), nullable=True),
|
||||
sa.Column('fingerprint', sa.String(length=255), nullable=True),
|
||||
sa.Column('hashed_fingerprint', sa.String(length=255), nullable=True),
|
||||
sa.Column('bridgeline', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['conf_id'], ['bridge_conf.id'], name=op.f('fk_bridge_conf_id_bridge_conf')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_bridge'))
|
||||
)
|
||||
op.create_table('proxy',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('origin_id', sa.Integer(), nullable=False),
|
||||
sa.Column('pool_id', sa.Integer(), nullable=True),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('psg', sa.Integer(), nullable=True),
|
||||
sa.Column('slug', sa.String(length=20), nullable=True),
|
||||
sa.Column('terraform_updated', sa.DateTime(), nullable=True),
|
||||
sa.Column('url', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], name=op.f('fk_proxy_origin_id_origin')),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pool.id'], name=op.f('fk_proxy_pool_id_pool')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_proxy'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('proxy')
|
||||
op.drop_table('bridge')
|
||||
op.drop_table('smart_proxy')
|
||||
op.drop_table('pool_group')
|
||||
op.drop_table('origin')
|
||||
op.drop_table('onion')
|
||||
op.drop_table('mirror_list')
|
||||
op.drop_table('eotk')
|
||||
op.drop_table('bridge_conf')
|
||||
op.drop_table('automation_logs')
|
||||
op.drop_table('webhook')
|
||||
op.drop_table('terraform_state')
|
||||
op.drop_table('pool')
|
||||
op.drop_table('group')
|
||||
op.drop_table('automation')
|
||||
op.drop_table('alarm')
|
||||
op.drop_table('activity')
|
||||
# ### end Alembic commands ###
|
|
@ -1,58 +0,0 @@
|
|||
"""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 ###
|
|
@ -1,61 +0,0 @@
|
|||
"""activities
|
||||
|
||||
Revision ID: 6f3e327e3b87
|
||||
Revises: 7ecfb305d243
|
||||
Create Date: 2022-05-14 09:10:57.320077
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6f3e327e3b87'
|
||||
down_revision = '7ecfb305d243'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('activity',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('group_id', sa.Integer(), nullable=True),
|
||||
sa.Column('activity_type', sa.String(length=20), nullable=False),
|
||||
sa.Column('text', sa.Text(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_activity'))
|
||||
)
|
||||
op.create_table('webhook',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('format', sa.String(length=20), nullable=True),
|
||||
sa.Column('url', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_webhook'))
|
||||
)
|
||||
op.drop_table('eotk_instance')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('eotk_instance',
|
||||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
||||
sa.Column('added', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('deprecated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||||
sa.Column('deprecation_reason', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('destroyed', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
|
||||
sa.Column('group_id', sa.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.Column('provider', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
|
||||
sa.Column('region', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
|
||||
sa.Column('instance_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name='fk_eotk_instance_group_id_group'),
|
||||
sa.PrimaryKeyConstraint('id', name='pk_eotk_instance')
|
||||
)
|
||||
op.drop_table('webhook')
|
||||
op.drop_table('activity')
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""add role for s3 lists
|
||||
|
||||
Revision ID: 7155ba7dec60
|
||||
Revises: 0a0a65db7f01
|
||||
Create Date: 2022-05-11 16:07:30.363508
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7155ba7dec60'
|
||||
down_revision = '0a0a65db7f01'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('role', sa.String(length=255), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.drop_column('role')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,46 +0,0 @@
|
|||
"""add eotk provider
|
||||
|
||||
Revision ID: 7ecfb305d243
|
||||
Revises: 7155ba7dec60
|
||||
Create Date: 2022-05-13 15:34:59.922410
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7ecfb305d243'
|
||||
down_revision = '7155ba7dec60'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('eotk_instance',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('provider', sa.String(length=20), nullable=False),
|
||||
sa.Column('region', sa.String(length=20), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_eotk_instance_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_eotk_instance'))
|
||||
)
|
||||
with op.batch_alter_table('eotk', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('provider', sa.String(length=20), nullable=False))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('eotk', schema=None) as batch_op:
|
||||
batch_op.drop_column('provider')
|
||||
|
||||
op.drop_table('eotk_instance')
|
||||
# ### end Alembic commands ###
|
|
@ -1,36 +0,0 @@
|
|||
"""add encoding for distribution list
|
||||
|
||||
Revision ID: 9f5525e84960
|
||||
Revises: 6f3e327e3b87
|
||||
Create Date: 2022-05-16 17:03:40.367755
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9f5525e84960'
|
||||
down_revision = '6f3e327e3b87'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('encoding', sa.String(length=20), nullable=True))
|
||||
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.execute("UPDATE mirror_list SET encoding = 'json'")
|
||||
batch_op.alter_column('encoding', nullable=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('mirror_list', schema=None) as batch_op:
|
||||
batch_op.drop_column('encoding')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,54 +0,0 @@
|
|||
"""onion services
|
||||
|
||||
Revision ID: c3d6e95caa79
|
||||
Revises: 56fbcfa1138c
|
||||
Create Date: 2022-05-04 15:03:52.406674
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c3d6e95caa79'
|
||||
down_revision = '56fbcfa1138c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('eotk',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('deprecation_reason', sa.String(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=100), nullable=True),
|
||||
sa.Column('region', sa.String(length=20), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_eotk_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_eotk'))
|
||||
)
|
||||
op.create_table('onion',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('onion_name', sa.String(length=56), nullable=False),
|
||||
sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_onion_group_id_group')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_onion')),
|
||||
sa.UniqueConstraint('onion_name', name=op.f('uq_onion_onion_name'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('onion')
|
||||
op.drop_table('eotk')
|
||||
# ### end Alembic commands ###
|
|
@ -1,38 +0,0 @@
|
|||
"""adds keys and certs to onions
|
||||
|
||||
Revision ID: c4ce00f86823
|
||||
Revises: 45fedef32318
|
||||
Create Date: 2022-11-09 11:07:49.780172
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c4ce00f86823'
|
||||
down_revision = '45fedef32318'
|
||||
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.add_column(sa.Column('onion_public_key', sa.LargeBinary()))
|
||||
batch_op.add_column(sa.Column('onion_private_key', sa.LargeBinary()))
|
||||
batch_op.add_column(sa.Column('tls_public_key', sa.LargeBinary()))
|
||||
batch_op.add_column(sa.Column('tls_private_key', sa.LargeBinary()))
|
||||
|
||||
# ### 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.drop_column('tls_private_key')
|
||||
batch_op.drop_column('tls_public_key')
|
||||
batch_op.drop_column('onion_private_key')
|
||||
batch_op.drop_column('onion_public_key')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,40 +0,0 @@
|
|||
"""add asset origins
|
||||
|
||||
Revision ID: c644bb20d0e3
|
||||
Revises: 133961a48525
|
||||
Create Date: 2022-05-25 15:21:16.221418
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c644bb20d0e3'
|
||||
down_revision = '133961a48525'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('assets', sa.Boolean(), nullable=True))
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.execute("UPDATE origin SET assets=false")
|
||||
batch_op.alter_column('assets',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('origin', schema=None) as batch_op:
|
||||
batch_op.alter_column('smart',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=True)
|
||||
batch_op.drop_column('assets')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||
"""group destruction
|
||||
|
||||
Revision ID: c83bdf6bf959
|
||||
Revises: 59c9a5185e88
|
||||
Create Date: 2022-04-22 12:52:00.715824
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c83bdf6bf959'
|
||||
down_revision = '59c9a5185e88'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('group', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('destroyed', sa.DateTime(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('group', schema=None) as batch_op:
|
||||
batch_op.drop_column('destroyed')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,41 +0,0 @@
|
|||
"""add mirror lists
|
||||
|
||||
Revision ID: e1332e4cb910
|
||||
Revises: 07c4fb2af22c
|
||||
Create Date: 2022-03-31 13:33:49.067575
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e1332e4cb910'
|
||||
down_revision = '07c4fb2af22c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('mirror_list',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('provider', sa.String(length=255), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=False),
|
||||
sa.Column('format', sa.String(length=20), nullable=False),
|
||||
sa.Column('container', sa.String(length=255), nullable=False),
|
||||
sa.Column('branch', sa.String(length=255), nullable=False),
|
||||
sa.Column('filename', sa.String(length=255), nullable=False),
|
||||
sa.Column('added', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
||||
sa.Column('deprecated', sa.DateTime(), nullable=True),
|
||||
sa.Column('destroyed', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_mirror_list'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('mirror_list')
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue