38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""Update Inverter models enum
|
|
|
|
Revision ID: 3cb6ab91fdc2
|
|
Revises: f90d04c490dc
|
|
Create Date: 2017-06-26 12:41:17.882779
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3cb6ab91fdc2'
|
|
down_revision = 'f90d04c490dc'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
from alembic import op
|
|
from helix.constants.inverter_type import InverterType
|
|
|
|
|
|
def upgrade():
|
|
op.execute('COMMIT')
|
|
|
|
connection = None
|
|
if not op.get_context().as_sql:
|
|
connection = op.get_bind()
|
|
connection.execution_options(isolation_level='AUTOCOMMIT')
|
|
|
|
op.execute('''ALTER TYPE "InverterType" ADD VALUE IF NOT EXISTS \'%s\'''' % (str(InverterType.DELTA.MODEL_36KW.value), ))
|
|
op.execute('''ALTER TYPE "InverterType" ADD VALUE IF NOT EXISTS \'%s\'''' % (str(InverterType.DELTA.MODEL_42KW.value), ))
|
|
op.execute('''ALTER TYPE "InverterType" ADD VALUE IF NOT EXISTS \'%s\'''' % (str(InverterType.DELTA.MODEL_60KW.value), ))
|
|
op.execute('''ALTER TYPE "InverterType" ADD VALUE IF NOT EXISTS \'%s\'''' % (str(InverterType.DELTA.MODEL_80KW.value), ))
|
|
|
|
if connection is not None:
|
|
connection.execution_options(isolation_level='READ_COMMITTED')
|
|
|
|
|
|
def downgrade():
|
|
pass
|