pvc/api-daemon/migrations/versions/2d1daa722a0a_pvc_version_0_...

113 lines
4.2 KiB
Python

"""PVC version 0.6
Revision ID: 2d1daa722a0a
Revises:
Create Date: 2020-02-15 23:14:14.733134
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2d1daa722a0a'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('network_template',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('mac_template', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('script',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('script', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('storage_template',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('system_template',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('vcpu_count', sa.Integer(), nullable=False),
sa.Column('vram_mb', sa.Integer(), nullable=False),
sa.Column('serial', sa.Boolean(), nullable=False),
sa.Column('vnc', sa.Boolean(), nullable=False),
sa.Column('vnc_bind', sa.Text(), nullable=True),
sa.Column('node_limit', sa.Text(), nullable=True),
sa.Column('node_selector', sa.Text(), nullable=True),
sa.Column('node_autostart', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('userdata',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('userdata', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('network',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('network_template', sa.Integer(), nullable=True),
sa.Column('vni', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['network_template'], ['network_template.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('profile',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('system_template', sa.Integer(), nullable=True),
sa.Column('network_template', sa.Integer(), nullable=True),
sa.Column('storage_template', sa.Integer(), nullable=True),
sa.Column('userdata', sa.Integer(), nullable=True),
sa.Column('script', sa.Integer(), nullable=True),
sa.Column('arguments', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['network_template'], ['network_template.id'], ),
sa.ForeignKeyConstraint(['script'], ['script.id'], ),
sa.ForeignKeyConstraint(['storage_template'], ['storage_template.id'], ),
sa.ForeignKeyConstraint(['system_template'], ['system_template.id'], ),
sa.ForeignKeyConstraint(['userdata'], ['userdata.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('storage',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('storage_template', sa.Integer(), nullable=True),
sa.Column('pool', sa.Text(), nullable=False),
sa.Column('disk_id', sa.Text(), nullable=False),
sa.Column('source_volume', sa.Text(), nullable=True),
sa.Column('disk_size_gb', sa.Integer(), nullable=True),
sa.Column('mountpoint', sa.Text(), nullable=True),
sa.Column('filesystem', sa.Text(), nullable=True),
sa.Column('filesystem_args', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['storage_template'], ['storage_template.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('storage')
op.drop_table('profile')
op.drop_table('network')
op.drop_table('userdata')
op.drop_table('system_template')
op.drop_table('storage_template')
op.drop_table('script')
op.drop_table('network_template')
# ### end Alembic commands ###