48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""create pricing_configs table frn ow
|
|
|
|
Revision ID: 74bd9cedebdd
|
|
Revises: 2e27aeb65f28
|
|
Create Date: 2026-07-24 13:23:52.427837
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '74bd9cedebdd'
|
|
down_revision: Union[str, Sequence[str], None] = '2e27aeb65f28'
|
|
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.create_table('pricing_configs',
|
|
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
|
sa.Column('device_price', sa.FLOAT(), nullable=False),
|
|
sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
|
sa.CheckConstraint('id = 1', name='single_row_check'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
op.execute(
|
|
"""
|
|
INSERT INTO pricing_configs (id, device_price)
|
|
VALUES (1, 50.00)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
"""
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('pricing_configs')
|
|
# ### end Alembic commands ###
|