"""Add watermark_log table

Revision ID: 007
Revises: 006
Create Date: 2026-04-23 18:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision: str = "007"
down_revision: Union[str, None] = "006"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.create_table(
        "watermark_log",
        sa.Column("id", sa.Integer(), primary_key=True, index=True),
        sa.Column("user_id", sa.Integer(), sa.ForeignKey("sys_user.id"), nullable=False),
        sa.Column("export_type", sa.String(20), default="csv"),
        sa.Column("data_scope", sa.Text(), nullable=True),
        sa.Column("watermark_key", sa.String(64), nullable=False),
        sa.Column("created_at", sa.DateTime(), default=sa.func.now()),
    )


def downgrade() -> None:
    op.drop_table("watermark_log")
