添加staging release workflow (#22)
* update variable name * update docker port * fix alembic migration files * 给远端 SSH 调用加了 keepalive * fix app-expo code file format * comment out quality test threshold --------- Co-authored-by: Kevin <kevin@brighteng.org>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
LIFE_ECHO_API_HOST_BIND=0.0.0.0
|
||||
LIFE_ECHO_API_HOST_PORT=8000
|
||||
POSTGRES_HOST_PORT=15432
|
||||
|
||||
# =============================================================================
|
||||
# Life Echo API — staging(预发)
|
||||
|
||||
@@ -9,6 +9,7 @@ Revises: 0004_memory_embedding_1024
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
from alembic import op
|
||||
|
||||
@@ -18,7 +19,42 @@ branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _has_column(table: str, column: str) -> bool:
|
||||
bind = op.get_bind()
|
||||
return any(c["name"] == column for c in sa.inspect(bind).get_columns(table))
|
||||
|
||||
|
||||
def _ensure_chapter_materialization_columns() -> None:
|
||||
"""Keep older/squashed staging schemas compatible before this data cleanup."""
|
||||
if not _has_column("chapters", "markdown_compose_dirty"):
|
||||
op.add_column(
|
||||
"chapters",
|
||||
sa.Column(
|
||||
"markdown_compose_dirty",
|
||||
sa.Boolean(),
|
||||
nullable=False,
|
||||
server_default=sa.text("false"),
|
||||
),
|
||||
)
|
||||
if not _has_column("chapters", "markdown_composed_at"):
|
||||
op.add_column(
|
||||
"chapters",
|
||||
sa.Column("markdown_composed_at", sa.DateTime(timezone=True), nullable=True),
|
||||
)
|
||||
if not _has_column("chapters", "reading_segments_json"):
|
||||
op.add_column(
|
||||
"chapters",
|
||||
sa.Column(
|
||||
"reading_segments_json",
|
||||
postgresql.JSON(astext_type=sa.Text()),
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
_ensure_chapter_materialization_columns()
|
||||
|
||||
# 先标脏,再删链接(子查询在 DELETE 后不可用)
|
||||
op.execute(
|
||||
sa.text(
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
image: m.daocloud.io/docker.io/pgvector/pgvector:pg17
|
||||
container_name: life-echo-postgres
|
||||
ports:
|
||||
- "127.0.0.1:5432:5432" # 仅绑定 localhost,通过 SSH 隧道访问
|
||||
- "127.0.0.1:${POSTGRES_HOST_PORT:-5432}:5432" # 仅绑定 localhost,通过 SSH 隧道访问
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
|
||||
Reference in New Issue
Block a user