resource pool system

This commit is contained in:
Iain Learmonth 2022-09-26 13:40:59 +01:00
parent dc989dd7cb
commit 16f7e2199d
19 changed files with 382 additions and 105 deletions

View file

@ -0,0 +1,61 @@
"""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 ###