diff --git a/crawler/alembic/versions/e5f1bc4e3323_fix_typo_in_logitude_column.py b/crawler/alembic/versions/e5f1bc4e3323_fix_typo_in_logitude_column.py new file mode 100644 index 0000000..190b5f8 --- /dev/null +++ b/crawler/alembic/versions/e5f1bc4e3323_fix_typo_in_logitude_column.py @@ -0,0 +1,106 @@ +"""fix typo in logitude column + +Revision ID: e5f1bc4e3323 +Revises: 8220f657bae5 +Create Date: 2025-10-18 20:31:29.558034 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision: str = 'e5f1bc4e3323' +down_revision: Union[str, None] = '8220f657bae5' +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.drop_index(op.f('ix_user_email'), table_name='user') + op.drop_table('user') + op.drop_index(op.f('ix_rentlisting_last_seen'), table_name='rentlisting') + op.drop_index(op.f('ix_rentlisting_number_of_bedrooms'), table_name='rentlisting') + op.drop_index(op.f('ix_rentlisting_price'), table_name='rentlisting') + op.drop_index(op.f('ix_rentlisting_square_meters'), table_name='rentlisting') + op.drop_table('rentlisting') + op.drop_index(op.f('ix_buylisting_last_seen'), table_name='buylisting') + op.drop_index(op.f('ix_buylisting_number_of_bedrooms'), table_name='buylisting') + op.drop_index(op.f('ix_buylisting_price'), table_name='buylisting') + op.drop_index(op.f('ix_buylisting_square_meters'), table_name='buylisting') + op.drop_table('buylisting') + # ### end Alembic commands ### + + +def downgrade() -> None: + """Downgrade schema.""" + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('buylisting', + sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), + sa.Column('price', mysql.FLOAT(), nullable=False), + sa.Column('number_of_bedrooms', mysql.INTEGER(), autoincrement=False, nullable=False), + sa.Column('square_meters', mysql.FLOAT(), nullable=True), + sa.Column('agency', mysql.VARCHAR(length=255), nullable=True), + sa.Column('council_tax_band', mysql.VARCHAR(length=255), nullable=True), + sa.Column('longtitude', mysql.FLOAT(), nullable=False), + sa.Column('latitude', mysql.FLOAT(), nullable=False), + sa.Column('price_history_json', mysql.TEXT(), nullable=False), + sa.Column('listing_site', mysql.ENUM('RIGHTMOVE'), nullable=False), + sa.Column('last_seen', mysql.DATETIME(), nullable=False), + sa.Column('photo_thumbnail', mysql.VARCHAR(length=255), nullable=True), + sa.Column('floorplan_image_paths', mysql.JSON(), nullable=False), + sa.Column('additional_info', mysql.JSON(), nullable=False), + sa.Column('routing_info_json', mysql.TEXT(), nullable=True), + sa.Column('service_charge', mysql.FLOAT(), nullable=True), + sa.Column('lease_left', mysql.INTEGER(), autoincrement=False, nullable=True), + sa.PrimaryKeyConstraint('id'), + mysql_collate='utf8mb4_0900_ai_ci', + mysql_default_charset='utf8mb4', + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_buylisting_square_meters'), 'buylisting', ['square_meters'], unique=False) + op.create_index(op.f('ix_buylisting_price'), 'buylisting', ['price'], unique=False) + op.create_index(op.f('ix_buylisting_number_of_bedrooms'), 'buylisting', ['number_of_bedrooms'], unique=False) + op.create_index(op.f('ix_buylisting_last_seen'), 'buylisting', ['last_seen'], unique=False) + op.create_table('rentlisting', + sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), + sa.Column('price', mysql.FLOAT(), nullable=False), + sa.Column('number_of_bedrooms', mysql.INTEGER(), autoincrement=False, nullable=False), + sa.Column('square_meters', mysql.FLOAT(), nullable=True), + sa.Column('agency', mysql.VARCHAR(length=255), nullable=True), + sa.Column('council_tax_band', mysql.VARCHAR(length=255), nullable=True), + sa.Column('longtitude', mysql.FLOAT(), nullable=False), + sa.Column('latitude', mysql.FLOAT(), nullable=False), + sa.Column('price_history_json', mysql.TEXT(), nullable=False), + sa.Column('listing_site', mysql.ENUM('RIGHTMOVE'), nullable=False), + sa.Column('last_seen', mysql.DATETIME(), nullable=False), + sa.Column('photo_thumbnail', mysql.VARCHAR(length=255), nullable=True), + sa.Column('floorplan_image_paths', mysql.JSON(), nullable=False), + sa.Column('additional_info', mysql.JSON(), nullable=False), + sa.Column('routing_info_json', mysql.TEXT(), nullable=True), + sa.Column('available_from', mysql.DATETIME(), nullable=True), + sa.Column('furnish_type', mysql.ENUM('FURNISHED', 'UNFURNISHED', 'PART_FURNISHED', 'ASK_LANDLORD', 'UNKNOWN'), nullable=False), + sa.PrimaryKeyConstraint('id'), + mysql_collate='utf8mb4_0900_ai_ci', + mysql_default_charset='utf8mb4', + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_rentlisting_square_meters'), 'rentlisting', ['square_meters'], unique=False) + op.create_index(op.f('ix_rentlisting_price'), 'rentlisting', ['price'], unique=False) + op.create_index(op.f('ix_rentlisting_number_of_bedrooms'), 'rentlisting', ['number_of_bedrooms'], unique=False) + op.create_index(op.f('ix_rentlisting_last_seen'), 'rentlisting', ['last_seen'], unique=False) + op.create_table('user', + sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False), + sa.Column('email', mysql.VARCHAR(length=255), nullable=False), + sa.Column('password', mysql.VARCHAR(length=255), nullable=False), + sa.PrimaryKeyConstraint('id'), + mysql_collate='utf8mb4_0900_ai_ci', + mysql_default_charset='utf8mb4', + mysql_engine='InnoDB' + ) + op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True) + # ### end Alembic commands ###