forked from bcgov/STRR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API changes - Property Details (bcgov#216)
* API changes - Property Details * Added max length for location description
- Loading branch information
1 parent
7d5f20f
commit 7cd6379
Showing
14 changed files
with
168 additions
and
10 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
strr-api/migrations/versions/20241023_2357_dbca5f95ed31_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"""empty message | ||
Revision ID: dbca5f95ed31 | ||
Revises: a3cf5bb26f36 | ||
Create Date: 2024-10-23 23:57:23.616885 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'dbca5f95ed31' | ||
down_revision = 'a3cf5bb26f36' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
rentalunitspacetype = postgresql.ENUM('ENTIRE_HOME', 'SHARED_ACCOMMODATION', name='rentalunitspacetype') | ||
rentalunitspacetype.create(op.get_bind(), checkfirst=True) | ||
|
||
hostresidence = postgresql.ENUM('SAME_UNIT', 'ANOTHER_UNIT', name='hostresidence') | ||
hostresidence.create(op.get_bind(), checkfirst=True) | ||
|
||
with op.batch_alter_table('addresses', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('location_description', sa.String(), nullable=True)) | ||
|
||
with op.batch_alter_table('addresses_history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('location_description', sa.String(), autoincrement=False, nullable=True)) | ||
|
||
with op.batch_alter_table('rental_properties', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('space_type', rentalunitspacetype, nullable=False)) | ||
batch_op.add_column(sa.Column('host_residence', hostresidence, nullable=False)) | ||
batch_op.add_column(sa.Column('is_unit_on_principal_residence_property', sa.Boolean(), nullable=False)) | ||
batch_op.add_column(sa.Column('number_of_rooms_for_rent', sa.Integer(), nullable=False)) | ||
|
||
with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('space_type', sa.Enum('ENTIRE_HOME', 'SHARED_ACCOMMODATION', name='rentalunitspacetype'), autoincrement=False, nullable=False)) | ||
batch_op.add_column(sa.Column('host_residence', sa.Enum('SAME_UNIT', 'ANOTHER_UNIT', name='hostresidence'), autoincrement=False, nullable=False)) | ||
batch_op.add_column(sa.Column('is_unit_on_principal_residence_property', sa.Boolean(), autoincrement=False, nullable=False)) | ||
batch_op.add_column(sa.Column('number_of_rooms_for_rent', sa.Integer(), autoincrement=False, nullable=False)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('rental_properties_history', schema=None) as batch_op: | ||
batch_op.drop_column('number_of_rooms_for_rent') | ||
batch_op.drop_column('is_unit_on_principal_residence_property') | ||
batch_op.drop_column('host_residence') | ||
batch_op.drop_column('space_type') | ||
|
||
with op.batch_alter_table('rental_properties', schema=None) as batch_op: | ||
batch_op.drop_column('number_of_rooms_for_rent') | ||
batch_op.drop_column('is_unit_on_principal_residence_property') | ||
batch_op.drop_column('host_residence') | ||
batch_op.drop_column('space_type') | ||
|
||
with op.batch_alter_table('addresses_history', schema=None) as batch_op: | ||
batch_op.drop_column('location_description') | ||
|
||
with op.batch_alter_table('addresses', schema=None) as batch_op: | ||
batch_op.drop_column('location_description') | ||
|
||
op.execute("DROP TYPE IF EXISTS rentalunitspacetype;") | ||
op.execute("DROP TYPE IF EXISTS propertytype;") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.