Merge branch 'main' of https://git.nianxx.cn/duanshuwen/WonderQ-Project
This commit is contained in:
commit
8f000811a8
15 files changed
+794
-1
No files matched your search
@@ -40,6 +40,20 @@ def _drop_column_with_foreign_keys(table_name: str, column_name: str) -> None:
|
||||
op.drop_column(table_name, column_name)
|
||||
|
||||
|
||||
def _drop_referencing_foreign_keys(table_name: str) -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = inspect(bind)
|
||||
for current_table in inspector.get_table_names():
|
||||
if current_table == table_name:
|
||||
continue
|
||||
for foreign_key in inspector.get_foreign_keys(current_table):
|
||||
if foreign_key.get("referred_table") != table_name:
|
||||
continue
|
||||
constraint_name = foreign_key.get("name")
|
||||
if constraint_name:
|
||||
op.drop_constraint(constraint_name, current_table, type_="foreignkey")
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
@@ -49,6 +63,7 @@ def upgrade() -> None:
|
||||
|
||||
for table_name in (*PRODUCT_TABLES[:3], "RouteSection", "DemandRecommendation", *PRODUCT_TABLES[3:]):
|
||||
if table_name in existing_tables:
|
||||
_drop_referencing_foreign_keys(table_name)
|
||||
op.drop_table(table_name)
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ SEED_TEAM_BUILDINGS = (
|
||||
"detailParagraphs": ["洞穴、瀑降与协作,适合 10-30 人。"],
|
||||
"image": "https://dimg04.c-ctrip.com/images/1mh0412000njfr1ot9453_W_640_10000.jpg?proc=autoorient",
|
||||
"demandKeyword": "户外团建",
|
||||
"detailSubtitle": "洞穴、瀑降与协作,适合 10-30 人。",
|
||||
"detailParagraphs": ["洞穴、瀑降与协作,适合 10-30 人。"],
|
||||
"isActive": True,
|
||||
"sortOrder": 0,
|
||||
},
|
||||
@@ -65,6 +67,8 @@ SEED_TEAM_BUILDINGS = (
|
||||
"detailParagraphs": ["溯溪与分组协作,兼顾参与感与安全。"],
|
||||
"image": "https://dimg04.c-ctrip.com/images/0EQ5712000ca7t504EC0E_W_640_10000.jpg?proc=autoorient",
|
||||
"demandKeyword": "峡谷团建",
|
||||
"detailSubtitle": "溯溪与分组协作,兼顾参与感与安全。",
|
||||
"detailParagraphs": ["溯溪与分组协作,兼顾参与感与安全。"],
|
||||
"isActive": True,
|
||||
"sortOrder": 1,
|
||||
},
|
||||
@@ -77,6 +81,8 @@ SEED_TEAM_BUILDINGS = (
|
||||
"detailParagraphs": ["夜游、长桌宴与文化体验,适合团建收尾。"],
|
||||
"image": "https://p6.itc.cn/q_70/images03/20200918/df728d2b79d943da869333e2ea2c92c8.jpeg",
|
||||
"demandKeyword": "贵州团建",
|
||||
"detailSubtitle": "夜游、长桌宴与文化体验,适合团建收尾。",
|
||||
"detailParagraphs": ["夜游、长桌宴与文化体验,适合团建收尾。"],
|
||||
"isActive": True,
|
||||
"sortOrder": 2,
|
||||
},
|
||||
@@ -106,6 +112,7 @@ SEED_WILD_ARCHIVES = (
|
||||
"title": "石龙洞",
|
||||
"image": "https://www.zurnal24.si/media/img/5e/d5/9526a56dba168aa136f3.jpeg",
|
||||
"images": ["https://www.zurnal24.si/media/img/5e/d5/9526a56dba168aa136f3.jpeg"],
|
||||
"images": ["https://www.zurnal24.si/media/img/5e/d5/9526a56dba168aa136f3.jpeg"],
|
||||
"demandKeyword": "地心探险",
|
||||
"isActive": True,
|
||||
"sortOrder": 1,
|
||||
@@ -115,6 +122,7 @@ SEED_WILD_ARCHIVES = (
|
||||
"title": "绝壁迎流",
|
||||
"image": "https://q9.itc.cn/q_70/images03/20250810/b62f5afc191a4947a66e6b32721b0235.jpeg",
|
||||
"images": ["https://q9.itc.cn/q_70/images03/20250810/b62f5afc191a4947a66e6b32721b0235.jpeg"],
|
||||
"images": ["https://q9.itc.cn/q_70/images03/20250810/b62f5afc191a4947a66e6b32721b0235.jpeg"],
|
||||
"demandKeyword": "峡谷探险",
|
||||
"isActive": True,
|
||||
"sortOrder": 2,
|
||||
|
||||
@@ -7,6 +7,7 @@ Revises: 0018_home_wanfa_recommendations
|
||||
from alembic import context, op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ Revises: 0019_home_wild_archive_images
|
||||
from alembic import context, op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from datetime import datetime
|
||||
from alembic import context, op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
@@ -93,6 +94,12 @@ def upgrade() -> None:
|
||||
for index_name in missing_detail_record_indexes(existing_index_names):
|
||||
op.create_index(index_name, "DetailRecord", DETAIL_RECORD_INDEXES[index_name])
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
if "DetailRecord" not in set(inspect(bind).get_table_names()):
|
||||
_create_detail_table()
|
||||
|
||||
detail_table = sa.table(
|
||||
"DetailRecord",
|
||||
sa.column("id", sa.String()),
|
||||
|
||||
@@ -7,6 +7,7 @@ Revises: 0022_opaque_ids
|
||||
from alembic import context, op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "0023_detail_concierge_advisor"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from alembic import context, op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user