"""Add temperature

Revision ID: fc391d505594
Revises: 78371c256762
Create Date: 2025-06-15 20:03:15.039980

"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

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


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "measurement_temperature",
        sa.Column("measured_ts", sa.DateTime(), nullable=True),
        sa.Column("value", sa.Float(), nullable=True),
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("tenant", sa.UUID(), nullable=True),
        sa.Column("external_id", sa.Text(), nullable=True),
        sa.Column("meter_id", sa.Text(), nullable=True),
        sa.Column("created_ts", sa.DateTime(), nullable=True),
        sa.Column("updated_ts", sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("tenant", "meter_id", "measured_ts"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("measurement_temperature")
    # ### end Alembic commands ###
