"""add device_daily_snapshots table Revision ID: e5f6a7b8c9d0 Revises: d4e5f6a7b8c9 Create Date: 2026-04-05 """ from alembic import op import sqlalchemy as sa revision = 'e5f6a7b8c9d0' down_revision = 'd4e5f6a7b8c9' branch_labels = None depends_on = None def upgrade(): op.create_table( 'device_daily_snapshots', sa.Column('id', sa.BigInteger(), primary_key=True, index=True), sa.Column('snapshot_date', sa.String(10), nullable=False), sa.Column('total', sa.Integer(), nullable=False, server_default='0'), sa.Column('online', sa.Integer(), nullable=False, server_default='0'), sa.Column('offline', sa.Integer(), nullable=False, server_default='0'), sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('now()')), ) op.create_index('ix_device_daily_snapshots_snapshot_date', 'device_daily_snapshots', ['snapshot_date']) def downgrade(): op.drop_index('ix_device_daily_snapshots_snapshot_date', 'device_daily_snapshots') op.drop_table('device_daily_snapshots')