"""non nullable

Revision ID: 66e9df67a7ec
Revises: 608f976c28d4
Create Date: 2026-02-23 16:45:55.414676

"""

from typing import Sequence, Union

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

# revision identifiers, used by Alembic.
revision: str = "66e9df67a7ec"
down_revision: Union[str, Sequence[str], None] = "608f976c28d4"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "guards",
        "created_by",
        existing_type=sa.VARCHAR(),
        nullable=False,
        existing_server_default=sa.text("'guardrails-api'::character varying"),
    )
    op.alter_column(
        "guards",
        "created_at",
        existing_type=postgresql.TIMESTAMP(),
        nullable=False,
        existing_server_default=sa.text("CURRENT_TIMESTAMP"),
    )
    op.alter_column(
        "guards",
        "updated_by",
        existing_type=sa.VARCHAR(),
        nullable=False,
        existing_server_default=sa.text("'guardrails-api'::character varying"),
    )
    op.alter_column(
        "guards",
        "updated_at",
        existing_type=postgresql.TIMESTAMP(),
        nullable=False,
        existing_server_default=sa.text("CURRENT_TIMESTAMP"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "guards",
        "updated_at",
        existing_type=postgresql.TIMESTAMP(),
        nullable=True,
        existing_server_default=sa.text("CURRENT_TIMESTAMP"),
    )
    op.alter_column(
        "guards",
        "updated_by",
        existing_type=sa.VARCHAR(),
        nullable=True,
        existing_server_default=sa.text("'guardrails-api'::character varying"),
    )
    op.alter_column(
        "guards",
        "created_at",
        existing_type=postgresql.TIMESTAMP(),
        nullable=True,
        existing_server_default=sa.text("CURRENT_TIMESTAMP"),
    )
    op.alter_column(
        "guards",
        "created_by",
        existing_type=sa.VARCHAR(),
        nullable=True,
        existing_server_default=sa.text("'guardrails-api'::character varying"),
    )
    # ### end Alembic commands ###
