diff --git a/alembic/versions/1a457651bb36_made_longitude_and_latitude_in_vehicle_.py b/alembic/versions/1a457651bb36_made_longitude_and_latitude_in_vehicle_.py new file mode 100644 index 0000000..e4cff01 --- /dev/null +++ b/alembic/versions/1a457651bb36_made_longitude_and_latitude_in_vehicle_.py @@ -0,0 +1,40 @@ +"""Made longitude and latitude in vehicle nullable + +Revision ID: 1a457651bb36 +Revises: 2ea50aba1814 +Create Date: 2024-10-16 07:33:17.926441 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '1a457651bb36' +down_revision: Union[str, None] = '2ea50aba1814' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('vehicles', 'latitude', + existing_type=sa.VARCHAR(), + nullable=True) + op.alter_column('vehicles', 'longitude', + existing_type=sa.VARCHAR(), + nullable=True) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('vehicles', 'longitude', + existing_type=sa.VARCHAR(), + nullable=False) + op.alter_column('vehicles', 'latitude', + existing_type=sa.VARCHAR(), + nullable=False) + # ### end Alembic commands ### diff --git a/app/models.py b/app/models.py index c738866..eb6f8db 100644 --- a/app/models.py +++ b/app/models.py @@ -62,8 +62,8 @@ class Vehicle(Base): kilometers = Column(Integer, nullable=False) condition = Column(String, nullable=False) location = Column(String, nullable=False) - latitude = Column(String, nullable=False) - longitude = Column(String, nullable=False) + latitude = Column(String, nullable=True) + longitude = Column(String, nullable=True) gasType = Column(String, nullable=False) images = Column(Text, nullable=False) # Store image paths or references description = Column(String, nullable=False)