Re-create migrations init tables

This commit is contained in:
Urtzi Alfaro
2025-10-09 20:47:31 +02:00
parent b420af32c5
commit dbc7f2fa0d
19 changed files with 112 additions and 195 deletions

View File

@@ -1,8 +1,8 @@
"""initial_schema_20251006_1517
"""initial_schema_20251009_2039
Revision ID: 706c5b559062
Revision ID: cae963fbc2af
Revises:
Create Date: 2025-10-06 15:17:05.820037+02:00
Create Date: 2025-10-09 20:39:42.106460+02:00
"""
from typing import Sequence, Union
@@ -12,7 +12,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '706c5b559062'
revision: str = 'cae963fbc2af'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
@@ -24,7 +24,7 @@ def upgrade() -> None:
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('tenant_id', sa.UUID(), nullable=False),
sa.Column('inventory_product_id', sa.UUID(), nullable=False),
sa.Column('product_name', sa.String(length=255), nullable=False),
sa.Column('product_name', sa.String(length=255), nullable=True),
sa.Column('location', sa.String(length=255), nullable=False),
sa.Column('forecast_date', sa.DateTime(timezone=True), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),

View File

@@ -1,32 +0,0 @@
"""make product_name nullable
Revision ID: a1b2c3d4e5f6
Revises: 706c5b559062
Create Date: 2025-10-09 04:55:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'a1b2c3d4e5f6'
down_revision: Union[str, None] = '706c5b559062'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# Make product_name nullable since we use inventory_product_id as the primary reference
op.alter_column('forecasts', 'product_name',
existing_type=sa.VARCHAR(length=255),
nullable=True)
def downgrade() -> None:
# Revert to not null (requires data to be populated first)
op.alter_column('forecasts', 'product_name',
existing_type=sa.VARCHAR(length=255),
nullable=False)