mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-29 14:29:06 +00:00
refactor: Migrate database service to SQLModel and Alembic.
- Add SQLModel for type-safe database models - Implement Alembic for schema migration management - Create 7 migrations covering all existing schema changes - Add automatic migration system that runs on startup - Maintain backward compatibility with existing raw SQL queries - Remove old manual migration system - All tests pass (109 tests) Benefits: - Full type safety with Pydantic validation - Version-controlled schema changes - Automatic migration detection and application - Better developer experience with typed models
This commit is contained in:
33
alembic/versions/dd9f6a55604c_add_logo_column.py
Normal file
33
alembic/versions/dd9f6a55604c_add_logo_column.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""add_logo_column
|
||||
|
||||
Add logo column to accounts table.
|
||||
|
||||
Revision ID: dd9f6a55604c
|
||||
Revises: f854fd498a6e
|
||||
Create Date: 2025-09-30 23:16:35.530858
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "dd9f6a55604c"
|
||||
down_revision: Union[str, Sequence[str], None] = "f854fd498a6e"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Add logo column to accounts table."""
|
||||
with op.batch_alter_table("accounts", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("logo", sa.String(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Remove logo column."""
|
||||
with op.batch_alter_table("accounts", schema=None) as batch_op:
|
||||
batch_op.drop_column("logo")
|
||||
Reference in New Issue
Block a user