"""add announcements

Revision ID: 4395a04f7784
Revises: cdc93edaf73d
Create Date: 2026-03-27 20:19:07.459075

"""

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = "4395a04f7784"
down_revision: str | None = "cdc93edaf73d"
branch_labels: str | tuple[str, ...] | None = None
depends_on: str | tuple[str, ...] | None = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("group_preferences", schema=None) as batch_op:
        batch_op.add_column(sa.Column("show_announcements", sa.Boolean(), nullable=False, server_default=sa.true()))

    with op.batch_alter_table("household_preferences", schema=None) as batch_op:
        batch_op.add_column(sa.Column("show_announcements", sa.Boolean(), nullable=False, server_default=sa.true()))

    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.add_column(sa.Column("show_announcements", sa.Boolean(), nullable=False, server_default=sa.true()))
        batch_op.add_column(sa.Column("last_read_announcement", sa.String(), nullable=True))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.drop_column("last_read_announcement")
        batch_op.drop_column("show_announcements")

    with op.batch_alter_table("household_preferences", schema=None) as batch_op:
        batch_op.drop_column("show_announcements")

    with op.batch_alter_table("group_preferences", schema=None) as batch_op:
        batch_op.drop_column("show_announcements")

    # ### end Alembic commands ###
