"""automation_saved_state_triggered_by

Revision ID: 0254
Revises: 0253
Create Date: 2023-06-26 10:40:57.233153

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


# revision identifiers, used by Alembic.
revision = '0254'
down_revision = '0253'
branch_labels = None
depends_on = None


def upgrade():
    op.add_column('automation_states', sa.Column('triggered_by_user_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'automation_states', 'users', ['triggered_by_user_id'], ['id'], ondelete='SET NULL')


def downgrade():
    op.drop_column('automation_states', 'triggered_by_user_id')
