Files
eamco_office_api/migrations/versions/a1b2c3d4e5f6_add_admin_settings_table.py
Edwin Eames 3066754821 feat: add admin settings system and improve customer/pricing endpoints
Add centralized admin settings (company info, social links, quick calls,
sidebar visibility toggles, theme, logo upload) with singleton pattern
and full CRUD API. Add active/dedicated customer count endpoints for
dashboard stats. Fix automatic assignment route to use PUT instead of
GET. Refactor oil price endpoint to use schema serialization with null
safety.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:45:06 -05:00

45 lines
1.8 KiB
Python

"""Add admin_settings table
Revision ID: a1b2c3d4e5f6
Revises: 3d217261c994
Create Date: 2026-02-08 00:00:00.000000
NOTE: Move this file to migrations/versions/ before running flask db upgrade.
Run: sudo mv eamco_office_api/a1b2c3d4e5f6_add_admin_settings_table.py eamco_office_api/migrations/versions/
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a1b2c3d4e5f6'
down_revision = '3d217261c994'
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'admin_settings',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
sa.Column('logo_base64', sa.Text(), nullable=True),
sa.Column('logo_mime_type', sa.VARCHAR(length=50), nullable=True),
sa.Column('company_name', sa.VARCHAR(length=250), server_default='Auburn Oil', nullable=True),
sa.Column('link_facebook', sa.VARCHAR(length=500), nullable=True),
sa.Column('link_google', sa.VARCHAR(length=500), nullable=True),
sa.Column('link_website', sa.VARCHAR(length=500), nullable=True),
sa.Column('link_google_review', sa.VARCHAR(length=500), nullable=True),
sa.Column('quick_calls', sa.Text(), nullable=True),
sa.Column('show_automatics', sa.Boolean(), server_default='true', nullable=True),
sa.Column('show_stats', sa.Boolean(), server_default='true', nullable=True),
sa.Column('show_service', sa.Boolean(), server_default='true', nullable=True),
sa.Column('show_ticker', sa.Boolean(), server_default='true', nullable=True),
sa.Column('default_theme', sa.VARCHAR(length=50), server_default='ocean', nullable=True),
sa.PrimaryKeyConstraint('id'),
schema='public'
)
def downgrade():
op.drop_table('admin_settings', schema='public')