"""remove-builtin-template-user

Revision ID: ae662b25d9bc
Revises: d98acf217d43
Create Date: 2025-10-21 14:30:28.566192

"""
from alembic import op
import models as models


def _is_pg(conn):
    return conn.dialect.name == "postgresql"
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ae662b25d9bc'
down_revision = 'd98acf217d43'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
        batch_op.drop_column('updated_by')
        batch_op.drop_column('created_by')

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    
    if _is_pg(conn):
        with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
            batch_op.add_column(sa.Column('created_by', sa.UUID(), autoincrement=False, nullable=False))
            batch_op.add_column(sa.Column('updated_by', sa.UUID(), autoincrement=False, nullable=True))
    else:
        with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
            batch_op.add_column(sa.Column('created_by', models.types.StringUUID(), autoincrement=False, nullable=False))
            batch_op.add_column(sa.Column('updated_by', models.types.StringUUID(), autoincrement=False, nullable=True))

    # ### end Alembic commands ###
