From 9aca9a6e133e00689966fc05ae30769a38cf6fcc Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Fri, 7 Feb 2025 13:47:25 -0800 Subject: [PATCH 1/6] strata hotel category api Signed-off-by: Shaanjot Gill --- .../versions/20250204_1137_7e9fccbeb3ed_.py | 42 +++++++++++++++++++ strr-api/src/strr_api/enums/enum.py | 9 ++++ strr-api/src/strr_api/models/rental.py | 3 +- strr-api/src/strr_api/models/strata_hotels.py | 9 +--- .../strr_api/requests/RegistrationRequest.py | 3 +- .../responses/RegistrationSerializer.py | 1 + .../schemas/schemas/host-registration.json | 8 ++++ .../strr_api/services/registration_service.py | 1 + .../tests/mocks/json/host_registration.json | 3 +- .../postman/strr-api.postman_collection.json | 2 +- 10 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py diff --git a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py new file mode 100644 index 00000000..ec18ac93 --- /dev/null +++ b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py @@ -0,0 +1,42 @@ +"""empty message + +Revision ID: 7e9fccbeb3ed +Revises: 73f39f000110 +Create Date: 2025-02-04 11:37:53.005700 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '7e9fccbeb3ed' +down_revision = '73f39f000110' +branch_labels = None +depends_on = None + + +def upgrade(): + stratahotelcategory = postgresql.ENUM('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory') + stratahotelcategory.create(op.get_bind(), checkfirst=True) + + with op.batch_alter_table('rental_properties', schema=None) as batch_op: + batch_op.add_column(sa.Column('strata_hotel_category', sa.Enum('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory'), nullable=True)) + batch_op.create_index(batch_op.f('ix_rental_properties_strata_hotel_category'), ['strata_hotel_category'], unique=False) + + with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: + batch_op.add_column(sa.Column('strata_hotel_category', sa.Enum('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory'), autoincrement=False, nullable=True)) + batch_op.create_index(batch_op.f('ix_rental_properties_history_strata_hotel_category'), ['strata_hotel_category'], unique=False) + + +def downgrade(): + with op.batch_alter_table('rental_properties', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_rental_properties_strata_hotel_category')) + batch_op.drop_column('strata_hotel_category') + + with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_rental_properties_history_strata_hotel_category')) + batch_op.drop_column('strata_hotel_category') + + stratahotelcategory = postgresql.ENUM(name='stratahotelcategory') + stratahotelcategory.drop(op.get_bind(), checkfirst=True) diff --git a/strr-api/src/strr_api/enums/enum.py b/strr-api/src/strr_api/enums/enum.py index deb91999..bb8b9ef8 100644 --- a/strr-api/src/strr_api/enums/enum.py +++ b/strr-api/src/strr_api/enums/enum.py @@ -14,6 +14,7 @@ """Enum definitions.""" from enum import Enum +from strr_api.common.enum import BaseEnum, auto class AuthHeaderType(Enum): @@ -163,3 +164,11 @@ class ApplicationRole(Enum): """STRR Application Roles.""" HOST = "HOST" + + +class StrataHotelCategory(BaseEnum): + """Enum of the strata hotel category.""" + + FULL_SERVICE = auto() # pylint: disable=invalid-name + MULTI_UNIT_NON_PR = auto() # pylint: disable=invalid-name + POST_DECEMBER_2023 = auto() # pylint: disable=invalid-name diff --git a/strr-api/src/strr_api/models/rental.py b/strr-api/src/strr_api/models/rental.py index 63cf929e..7409df29 100644 --- a/strr-api/src/strr_api/models/rental.py +++ b/strr-api/src/strr_api/models/rental.py @@ -10,7 +10,7 @@ from sqlalchemy.orm import relationship from strr_api.common.enum import BaseEnum, auto -from strr_api.enums.enum import PropertyType, RegistrationStatus +from strr_api.enums.enum import PropertyType, RegistrationStatus, StrataHotelCategory from strr_api.models.base_model import BaseModel from .db import db @@ -91,6 +91,7 @@ class OwnershipType(BaseEnum): is_unit_on_principal_residence_property = db.Column(db.Boolean, nullable=False) number_of_rooms_for_rent = db.Column(db.Integer, nullable=False) strata_hotel_registration_number = db.Column(db.String, nullable=True) + strata_hotel_category = db.Column(Enum(StrataHotelCategory), nullable=True, index=True) address_id = db.Column(db.Integer, db.ForeignKey("addresses.id"), nullable=False) registration_id = db.Column(db.Integer, db.ForeignKey("registrations.id"), nullable=False) diff --git a/strr-api/src/strr_api/models/strata_hotels.py b/strr-api/src/strr_api/models/strata_hotels.py index 1193b714..4ea1cf31 100644 --- a/strr-api/src/strr_api/models/strata_hotels.py +++ b/strr-api/src/strr_api/models/strata_hotels.py @@ -7,7 +7,7 @@ from sqlalchemy import Enum from sqlalchemy.orm import relationship -from strr_api.common.enum import BaseEnum, auto +from strr_api.enums.enum import StrataHotelCategory from strr_api.models.base_model import BaseModel from .db import db @@ -16,13 +16,6 @@ class StrataHotel(Versioned, BaseModel): """Strata Hotel""" - class StrataHotelCategory(BaseEnum): - """Enum of the strata hotel category.""" - - FULL_SERVICE = auto() # pylint: disable=invalid-name - MULTI_UNIT_NON_PR = auto() # pylint: disable=invalid-name - POST_DECEMBER_2023 = auto() # pylint: disable=invalid-name - __tablename__ = "strata_hotels" id = db.Column(db.Integer, primary_key=True, autoincrement=True) diff --git a/strr-api/src/strr_api/requests/RegistrationRequest.py b/strr-api/src/strr_api/requests/RegistrationRequest.py index f5c5975e..2b15298a 100644 --- a/strr-api/src/strr_api/requests/RegistrationRequest.py +++ b/strr-api/src/strr_api/requests/RegistrationRequest.py @@ -124,6 +124,7 @@ def __init__( blExemptReason=None, strataHotelRegistrationNumber=None, prExemptReason=None, + strataHotelCategory=None, ): self.propertyType = propertyType self.ownershipType = ownershipType @@ -137,7 +138,7 @@ def __init__( self.blExemptReason = blExemptReason self.strataHotelRegistrationNumber = strataHotelRegistrationNumber self.prExemptReason = prExemptReason - + self.strataHotelCategory = strataHotelCategory class MailingAddress: """MailingAddress payload object.""" diff --git a/strr-api/src/strr_api/responses/RegistrationSerializer.py b/strr-api/src/strr_api/responses/RegistrationSerializer.py index 8969a5d8..b2de3cf8 100644 --- a/strr-api/src/strr_api/responses/RegistrationSerializer.py +++ b/strr-api/src/strr_api/responses/RegistrationSerializer.py @@ -276,6 +276,7 @@ def populate_host_registration_details(cls, registration_data: dict, registratio "numberOfRoomsForRent": registration.rental_property.number_of_rooms_for_rent, "strataHotelRegistrationNumber": registration.rental_property.strata_hotel_registration_number, "prExemptReason": registration.rental_property.pr_exempt_reason, + "strataHotelCategory": registration.rental_property.strata_hotel_category, } registration_data["listingDetails"] = [ diff --git a/strr-api/src/strr_api/schemas/schemas/host-registration.json b/strr-api/src/strr_api/schemas/schemas/host-registration.json index 2652ea66..3c7192b5 100644 --- a/strr-api/src/strr_api/schemas/schemas/host-registration.json +++ b/strr-api/src/strr_api/schemas/schemas/host-registration.json @@ -184,6 +184,14 @@ "FARM_LAND", "FRACTIONAL_OWNERSHIP" ] + }, + "strataHotelCategory": { + "type": "string", + "enum": [ + "FULL_SERVICE", + "MULTI_UNIT_NON_PR", + "POST_DECEMBER_2023" + ] } }, "required": [ diff --git a/strr-api/src/strr_api/services/registration_service.py b/strr-api/src/strr_api/services/registration_service.py index b9cb1df3..22882167 100644 --- a/strr-api/src/strr_api/services/registration_service.py +++ b/strr-api/src/strr_api/services/registration_service.py @@ -299,6 +299,7 @@ def _create_host_registration(cls, registration_request: dict) -> RentalProperty pr_exempt_reason=registration_request.unitDetails.prExemptReason, property_listings=[PropertyListing(url=listing.url) for listing in registration_request.listingDetails], strata_hotel_registration_number=registration_request.unitDetails.strataHotelRegistrationNumber, + strata_hotel_category=registration_request.unitDetails.strataHotelCategory, ) if property_manager_info := registration_request.propertyManager: diff --git a/strr-api/tests/mocks/json/host_registration.json b/strr-api/tests/mocks/json/host_registration.json index f75200c9..0e9e299b 100644 --- a/strr-api/tests/mocks/json/host_registration.json +++ b/strr-api/tests/mocks/json/host_registration.json @@ -73,7 +73,8 @@ "isUnitOnPrincipalResidenceProperty": true, "numberOfRoomsForRent": 1, "prExemptReason": "FRACTIONAL_OWNERSHIP", - "blExemptReason": "This short-term rental does not offer bookings of under 30 days" + "blExemptReason": "This short-term rental does not offer bookings of under 30 days", + "strataHotelCategory": "MULTI_UNIT_NON_PR" }, "listingDetails": [ { diff --git a/strr-api/tests/postman/strr-api.postman_collection.json b/strr-api/tests/postman/strr-api.postman_collection.json index 19d635d1..f1b305b7 100644 --- a/strr-api/tests/postman/strr-api.postman_collection.json +++ b/strr-api/tests/postman/strr-api.postman_collection.json @@ -51,7 +51,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"header\": {\n \"paymentMethod\": \"DIRECT_PAY\"\n },\n \"registration\": {\n \"registrationType\": \"HOST\",\n \"primaryContact\": {\n \"firstName\": \"The\",\n \"middleName\": \"First\",\n \"lastName\": \"Guy\",\n \"dateOfBirth\": \"1986-10-23\",\n \"preferredName\": \"Mickey\",\n \"phoneCountryCode\": \"001\",\n \"phoneNumber\": \"604-999-9999\",\n \"extension\": \"x64\",\n \"faxNumber\": \"604-777-7777\",\n \"emailAddress\": \"test@test.test\",\n \"socialInsuranceNumber\":\"123 222 333\",\n \"mailingAddress\": {\n \"country\": \"CA\",\n \"address\": \"12766 227st\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 6K6\"\n }\n },\n \"secondaryContact\": {\n \"firstName\": \"The\",\n \"middleName\": \"Other\",\n \"lastName\": \"Guy\",\n \"dateOfBirth\": \"1986-10-23\",\n \"preferredName\": \"Mouse\",\n \"phoneCountryCode\": \"001\",\n \"phoneNumber\": \"604-888-8888\",\n \"extension\": \"\",\n \"faxNumber\": \"\",\n \"emailAddress\": \"test2@test.test\",\n \"mailingAddress\": {\n \"country\": \"CA\",\n \"address\": \"12766 227st\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 6K6\"\n }\n },\n \"unitAddress\": {\n \"nickname\": \"My Rental Property\",\n \"country\": \"CA\",\n \"unitNumber\": \"\",\n \"streetNumber\": \"12166\",\n \"streetName\": \"GREENWELL ST MAPLE RIDGE\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 7N1\"\n },\n \"strRequirements\": {\n \"isBusinessLicenceRequired\": false,\n \"isPrincipalResidenceRequired\": true,\n \"isStrProhibited\": false,\n \"isStraaExempt\": null,\n \"organizationNm\": \"City of Maple Ridge\"\n },\n \"unitDetails\": {\n \"parcelIdentifier\": \"000-460-991\",\n \"businessLicense\": \"7777777\",\n \"businessLicenseExpiryDate\": \"2025-01-01\",\n \"propertyType\": \"SINGLE_FAMILY_HOME\",\n \"ownershipType\": \"OWN\",\n \"rentalUnitSpaceType\": \"ENTIRE_HOME\",\n \"hostResidence\": \"SAME_UNIT\",\n \"isUnitOnPrincipalResidenceProperty\": true,\n \"numberOfRoomsForRent\": 1,\n \"blExemptReason\": \"This short-term rental does not offer bookings of under 30 days\",\n \"prExemptReason\": \"FRACTIONAL_OWNERSHIP\"\n },\n \"listingDetails\": [\n {\n \"url\": \"https://www.airbnb.ca/rooms/26359027\"\n }\n ],\n \"documents\": [\n {\n \"fileName\": \"Drivers License\",\n \"fileType\": \"pdf\",\n \"fileKey\": \"a1234\",\n \"documentType\": \"BC_DRIVERS_LICENSE\"\n }\n ]\n }\n}", + "raw": "{\n \"header\": {\n \"paymentMethod\": \"DIRECT_PAY\"\n },\n \"registration\": {\n \"registrationType\": \"HOST\",\n \"primaryContact\": {\n \"firstName\": \"The\",\n \"middleName\": \"First\",\n \"lastName\": \"Guy\",\n \"dateOfBirth\": \"1986-10-23\",\n \"preferredName\": \"Mickey\",\n \"phoneCountryCode\": \"001\",\n \"phoneNumber\": \"604-999-9999\",\n \"extension\": \"x64\",\n \"faxNumber\": \"604-777-7777\",\n \"emailAddress\": \"test@test.test\",\n \"socialInsuranceNumber\":\"123 222 333\",\n \"mailingAddress\": {\n \"country\": \"CA\",\n \"address\": \"12766 227st\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 6K6\"\n }\n },\n \"secondaryContact\": {\n \"firstName\": \"The\",\n \"middleName\": \"Other\",\n \"lastName\": \"Guy\",\n \"dateOfBirth\": \"1986-10-23\",\n \"preferredName\": \"Mouse\",\n \"phoneCountryCode\": \"001\",\n \"phoneNumber\": \"604-888-8888\",\n \"extension\": \"\",\n \"faxNumber\": \"\",\n \"emailAddress\": \"test2@test.test\",\n \"mailingAddress\": {\n \"country\": \"CA\",\n \"address\": \"12766 227st\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 6K6\"\n }\n },\n \"unitAddress\": {\n \"nickname\": \"My Rental Property\",\n \"country\": \"CA\",\n \"unitNumber\": \"\",\n \"streetNumber\": \"12166\",\n \"streetName\": \"GREENWELL ST MAPLE RIDGE\",\n \"addressLineTwo\": \"\",\n \"city\": \"MAPLE RIDGE\",\n \"province\": \"BC\",\n \"postalCode\": \"V2X 7N1\"\n },\n \"strRequirements\": {\n \"isBusinessLicenceRequired\": false,\n \"isPrincipalResidenceRequired\": true,\n \"isStrProhibited\": false,\n \"isStraaExempt\": null,\n \"organizationNm\": \"City of Maple Ridge\"\n },\n \"unitDetails\": {\n \"parcelIdentifier\": \"000-460-991\",\n \"businessLicense\": \"7777777\",\n \"businessLicenseExpiryDate\": \"2025-01-01\",\n \"propertyType\": \"SINGLE_FAMILY_HOME\",\n \"ownershipType\": \"OWN\",\n \"rentalUnitSpaceType\": \"ENTIRE_HOME\",\n \"hostResidence\": \"SAME_UNIT\",\n \"isUnitOnPrincipalResidenceProperty\": true,\n \"numberOfRoomsForRent\": 1,\n \"strataHotelCategory\": \"MULTI_UNIT_NON_PR\",\n \"blExemptReason\": \"This short-term rental does not offer bookings of under 30 days\",\n \"prExemptReason\": \"FRACTIONAL_OWNERSHIP\"\n },\n \"listingDetails\": [\n {\n \"url\": \"https://www.airbnb.ca/rooms/26359027\"\n }\n ],\n \"documents\": [\n {\n \"fileName\": \"Drivers License\",\n \"fileType\": \"pdf\",\n \"fileKey\": \"a1234\",\n \"documentType\": \"BC_DRIVERS_LICENSE\"\n }\n ]\n }\n}", "options": { "raw": { "language": "json" From fdd3edb75f7b711e6c84fe5da4a6798c503e7270 Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Mon, 10 Feb 2025 07:51:56 -0800 Subject: [PATCH 2/6] 25480 - isort fix Signed-off-by: Shaanjot Gill --- strr-api/src/strr_api/enums/enum.py | 1 + 1 file changed, 1 insertion(+) diff --git a/strr-api/src/strr_api/enums/enum.py b/strr-api/src/strr_api/enums/enum.py index bb8b9ef8..d7d3a1e2 100644 --- a/strr-api/src/strr_api/enums/enum.py +++ b/strr-api/src/strr_api/enums/enum.py @@ -14,6 +14,7 @@ """Enum definitions.""" from enum import Enum + from strr_api.common.enum import BaseEnum, auto From 1388c44faab7e6f95b7d292c562683011d758bf3 Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Mon, 10 Feb 2025 08:00:10 -0800 Subject: [PATCH 3/6] 25480 - black fmt changes Signed-off-by: Shaanjot Gill --- strr-api/src/strr_api/requests/RegistrationRequest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/strr-api/src/strr_api/requests/RegistrationRequest.py b/strr-api/src/strr_api/requests/RegistrationRequest.py index 2b15298a..eb40ff29 100644 --- a/strr-api/src/strr_api/requests/RegistrationRequest.py +++ b/strr-api/src/strr_api/requests/RegistrationRequest.py @@ -140,6 +140,7 @@ def __init__( self.prExemptReason = prExemptReason self.strataHotelCategory = strataHotelCategory + class MailingAddress: """MailingAddress payload object.""" From 8da3665f8ff0fcb68bf26722e21df66c5056b899 Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Mon, 10 Feb 2025 16:13:03 -0800 Subject: [PATCH 4/6] 25480 - migration update Signed-off-by: Shaanjot Gill --- strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py index ec18ac93..4c8ef6d1 100644 --- a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py +++ b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py @@ -17,9 +17,6 @@ def upgrade(): - stratahotelcategory = postgresql.ENUM('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory') - stratahotelcategory.create(op.get_bind(), checkfirst=True) - with op.batch_alter_table('rental_properties', schema=None) as batch_op: batch_op.add_column(sa.Column('strata_hotel_category', sa.Enum('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory'), nullable=True)) batch_op.create_index(batch_op.f('ix_rental_properties_strata_hotel_category'), ['strata_hotel_category'], unique=False) @@ -37,6 +34,3 @@ def downgrade(): with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_rental_properties_history_strata_hotel_category')) batch_op.drop_column('strata_hotel_category') - - stratahotelcategory = postgresql.ENUM(name='stratahotelcategory') - stratahotelcategory.drop(op.get_bind(), checkfirst=True) From cb1c522251feee2f4582536734413fa6ab435889 Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Thu, 13 Feb 2025 18:06:40 -0800 Subject: [PATCH 5/6] 25480 - revision id update Signed-off-by: Shaanjot Gill --- strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py index 4c8ef6d1..6225c170 100644 --- a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py +++ b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py @@ -1,7 +1,7 @@ """empty message Revision ID: 7e9fccbeb3ed -Revises: 73f39f000110 +Revises: 842bb132abc7 Create Date: 2025-02-04 11:37:53.005700 """ @@ -11,7 +11,7 @@ # revision identifiers, used by Alembic. revision = '7e9fccbeb3ed' -down_revision = '73f39f000110' +down_revision = '842bb132abc7' branch_labels = None depends_on = None From d4d564a74a7467b3e63613ac3495230a6dfffe9b Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Mon, 24 Feb 2025 14:35:20 -0800 Subject: [PATCH 6/6] 25480 - migration fix Signed-off-by: Shaanjot Gill --- strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py index 6225c170..004380b8 100644 --- a/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py +++ b/strr-api/migrations/versions/20250204_1137_7e9fccbeb3ed_.py @@ -15,14 +15,16 @@ branch_labels = None depends_on = None +stratahotelcategory = postgresql.ENUM('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory') +stratahotelcategory.create(op.get_bind(), checkfirst=True) def upgrade(): with op.batch_alter_table('rental_properties', schema=None) as batch_op: - batch_op.add_column(sa.Column('strata_hotel_category', sa.Enum('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory'), nullable=True)) + batch_op.add_column(sa.Column('strata_hotel_category', stratahotelcategory, nullable=True)) batch_op.create_index(batch_op.f('ix_rental_properties_strata_hotel_category'), ['strata_hotel_category'], unique=False) with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: - batch_op.add_column(sa.Column('strata_hotel_category', sa.Enum('FULL_SERVICE', 'MULTI_UNIT_NON_PR', 'POST_DECEMBER_2023', name='stratahotelcategory'), autoincrement=False, nullable=True)) + batch_op.add_column(sa.Column('strata_hotel_category', stratahotelcategory, autoincrement=False, nullable=True)) batch_op.create_index(batch_op.f('ix_rental_properties_history_strata_hotel_category'), ['strata_hotel_category'], unique=False)