"""added spacingBetweenTexts in textstyle

Peek Plugin Database Migration Script

Revision ID: 5307eb21c742
Revises: a4c59bcaaf88
Create Date: 2022-06-14 15:20:36.877084

"""

# revision identifiers, used by Alembic.
revision = "5307eb21c742"
down_revision = "a4c59bcaaf88"
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "DispTextStyle",
        sa.Column(
            "spacingBetweenTexts",
            sa.Float(),
            nullable=True,
        ),
        schema="pl_diagram",
    )
    op.execute(
        """UPDATE
            "pl_diagram"."DispTextStyle"
            SET
            "spacingBetweenTexts" = 100;"""
    )
    op.alter_column(
        "DispTextStyle",
        "spacingBetweenTexts",
        nullable=False,
        schema="pl_diagram",
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("DispTextStyle", "spacingBetweenTexts", schema="pl_diagram")
    # ### end Alembic commands ###
