Initial import
This commit is contained in:
commit
09f0b0672d
64 changed files with 3735 additions and 0 deletions
124
migrations/versions/07c4fb2af22c_initial_schema.py
Normal file
124
migrations/versions/07c4fb2af22c_initial_schema.py
Normal file
|
@ -0,0 +1,124 @@
|
|||
"""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 ###
|
|
@ -0,0 +1,38 @@
|
|||
"""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 ###
|
32
migrations/versions/5c69fe874e4d_add_bridge_nicknames.py
Normal file
32
migrations/versions/5c69fe874e4d_add_bridge_nicknames.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
"""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 ###
|
41
migrations/versions/e1332e4cb910_add_mirror_lists.py
Normal file
41
migrations/versions/e1332e4cb910_add_mirror_lists.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
"""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