feat: add hotel and vehicle option site modules
Add full support for hotel group and vehicle option site management features: - Define SQLAlchemy models and alembic migration for the new database tables - Add default sample content entries in content.py - Extend admin and public API routes to support the new modules - Update seed script to populate default hotel and vehicle data - Update all relevant documentation and test cases
This commit is contained in:
49
alembic/versions/0005_hotel_vehicle_modules.py
Normal file
49
alembic/versions/0005_hotel_vehicle_modules.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""Add hotel and vehicle site modules.
|
||||
|
||||
Revision ID: 0005_hotel_vehicle_modules
|
||||
Revises: 0004_route_sections
|
||||
Create Date: 2026-07-03
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "0005_hotel_vehicle_modules"
|
||||
down_revision = "0004_route_sections"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def _create_card_table(table_name: str) -> None:
|
||||
op.create_table(
|
||||
table_name,
|
||||
sa.Column("id", sa.String(), nullable=False),
|
||||
sa.Column("title", sa.String(), nullable=False),
|
||||
sa.Column("description", sa.Text(), nullable=True),
|
||||
sa.Column("image", sa.String(), nullable=True),
|
||||
sa.Column("sortOrder", sa.Integer(), nullable=False, server_default="0"),
|
||||
sa.Column("isActive", sa.Boolean(), nullable=False, server_default=sa.true()),
|
||||
sa.Column("createdAt", sa.DateTime(), nullable=False),
|
||||
sa.Column("updatedAt", sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
if "HotelGroup" not in existing_tables:
|
||||
_create_card_table("HotelGroup")
|
||||
if "VehicleOption" not in existing_tables:
|
||||
_create_card_table("VehicleOption")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
if "VehicleOption" in existing_tables:
|
||||
op.drop_table("VehicleOption")
|
||||
if "HotelGroup" in existing_tables:
|
||||
op.drop_table("HotelGroup")
|
||||
Reference in New Issue
Block a user