wip: snapshot full local workspace state
Some checks are pending
Build and Push Docker Images / changes (push) Waiting to run
Build and Push Docker Images / build-backend (push) Blocked by required conditions
Build and Push Docker Images / build-frontend (push) Blocked by required conditions
Build and Push Docker Images / build-admin-frontend (push) Blocked by required conditions
Some checks are pending
Build and Push Docker Images / changes (push) Waiting to run
Build and Push Docker Images / build-backend (push) Blocked by required conditions
Build and Push Docker Images / build-frontend (push) Blocked by required conditions
Build and Push Docker Images / build-admin-frontend (push) Blocked by required conditions
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
"""add api_key to providers
|
||||
|
||||
Revision ID: 0002_add_api_key_to_providers
|
||||
Revises: 0001_init_providers_and_story_mode
|
||||
Create Date: 2025-01-01
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "0002_add_api_key"
|
||||
down_revision = "0001_init_providers"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# 添加 api_key 列,可为空,优先于 config_ref 使用
|
||||
with op.batch_alter_table("providers", schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column("api_key", sa.String(length=500), nullable=True)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("providers", schema=None) as batch_op:
|
||||
batch_op.drop_column("api_key")
|
||||
"""add api_key to providers
|
||||
|
||||
Revision ID: 0002_add_api_key_to_providers
|
||||
Revises: 0001_init_providers_and_story_mode
|
||||
Create Date: 2025-01-01
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "0002_add_api_key"
|
||||
down_revision = "0001_init_providers"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# 添加 api_key 列,可为空,优先于 config_ref 使用
|
||||
with op.batch_alter_table("providers", schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column("api_key", sa.String(length=500), nullable=True)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("providers", schema=None) as batch_op:
|
||||
batch_op.drop_column("api_key")
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
"""add provider monitoring tables
|
||||
|
||||
Revision ID: 0003_add_monitoring
|
||||
Revises: 0002_add_api_key
|
||||
Create Date: 2025-01-01
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "0003_add_monitoring"
|
||||
down_revision = "0002_add_api_key"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# 创建 provider_metrics 表
|
||||
op.create_table(
|
||||
"provider_metrics",
|
||||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column("provider_id", sa.String(length=36), nullable=False),
|
||||
sa.Column(
|
||||
"timestamp",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column("success", sa.Boolean(), nullable=False),
|
||||
sa.Column("latency_ms", sa.Integer(), nullable=True),
|
||||
sa.Column("cost_usd", sa.Numeric(precision=10, scale=6), nullable=True),
|
||||
sa.Column("error_message", sa.Text(), nullable=True),
|
||||
sa.Column("request_id", sa.String(length=100), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["provider_id"],
|
||||
["providers.id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_provider_metrics_provider_id",
|
||||
"provider_metrics",
|
||||
["provider_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_provider_metrics_timestamp",
|
||||
"provider_metrics",
|
||||
["timestamp"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
# 创建 provider_health 表
|
||||
op.create_table(
|
||||
"provider_health",
|
||||
sa.Column("provider_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("is_healthy", sa.Boolean(), server_default=sa.text("true"), nullable=True),
|
||||
sa.Column("last_check", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("consecutive_failures", sa.Integer(), server_default=sa.text("0"), nullable=True),
|
||||
sa.Column("last_error", sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["provider_id"],
|
||||
["providers.id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("provider_id"),
|
||||
)
|
||||
|
||||
# 创建 provider_secrets 表
|
||||
op.create_table(
|
||||
"provider_secrets",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("name", sa.String(length=100), nullable=False),
|
||||
sa.Column("encrypted_value", sa.Text(), nullable=False),
|
||||
sa.Column(
|
||||
"created_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("name"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("provider_secrets")
|
||||
op.drop_table("provider_health")
|
||||
op.drop_index("ix_provider_metrics_timestamp", table_name="provider_metrics")
|
||||
op.drop_index("ix_provider_metrics_provider_id", table_name="provider_metrics")
|
||||
op.drop_table("provider_metrics")
|
||||
"""add provider monitoring tables
|
||||
|
||||
Revision ID: 0003_add_monitoring
|
||||
Revises: 0002_add_api_key
|
||||
Create Date: 2025-01-01
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "0003_add_monitoring"
|
||||
down_revision = "0002_add_api_key"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# 创建 provider_metrics 表
|
||||
op.create_table(
|
||||
"provider_metrics",
|
||||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column("provider_id", sa.String(length=36), nullable=False),
|
||||
sa.Column(
|
||||
"timestamp",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column("success", sa.Boolean(), nullable=False),
|
||||
sa.Column("latency_ms", sa.Integer(), nullable=True),
|
||||
sa.Column("cost_usd", sa.Numeric(precision=10, scale=6), nullable=True),
|
||||
sa.Column("error_message", sa.Text(), nullable=True),
|
||||
sa.Column("request_id", sa.String(length=100), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["provider_id"],
|
||||
["providers.id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_provider_metrics_provider_id",
|
||||
"provider_metrics",
|
||||
["provider_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_provider_metrics_timestamp",
|
||||
"provider_metrics",
|
||||
["timestamp"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
# 创建 provider_health 表
|
||||
op.create_table(
|
||||
"provider_health",
|
||||
sa.Column("provider_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("is_healthy", sa.Boolean(), server_default=sa.text("true"), nullable=True),
|
||||
sa.Column("last_check", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("consecutive_failures", sa.Integer(), server_default=sa.text("0"), nullable=True),
|
||||
sa.Column("last_error", sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["provider_id"],
|
||||
["providers.id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("provider_id"),
|
||||
)
|
||||
|
||||
# 创建 provider_secrets 表
|
||||
op.create_table(
|
||||
"provider_secrets",
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("name", sa.String(length=100), nullable=False),
|
||||
sa.Column("encrypted_value", sa.Text(), nullable=False),
|
||||
sa.Column(
|
||||
"created_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("name"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("provider_secrets")
|
||||
op.drop_table("provider_health")
|
||||
op.drop_index("ix_provider_metrics_timestamp", table_name="provider_metrics")
|
||||
op.drop_index("ix_provider_metrics_provider_id", table_name="provider_metrics")
|
||||
op.drop_table("provider_metrics")
|
||||
|
||||
@@ -39,4 +39,4 @@ def upgrade():
|
||||
|
||||
def downgrade():
|
||||
op.drop_index("idx_child_profiles_user_id", table_name="child_profiles")
|
||||
op.drop_table("child_profiles")
|
||||
op.drop_table("child_profiles")
|
||||
|
||||
@@ -64,4 +64,4 @@ def downgrade():
|
||||
|
||||
op.drop_index("idx_story_universes_updated_at", table_name="story_universes")
|
||||
op.drop_index("idx_story_universes_child_id", table_name="story_universes")
|
||||
op.drop_table("story_universes")
|
||||
op.drop_table("story_universes")
|
||||
|
||||
@@ -75,4 +75,4 @@ def downgrade():
|
||||
op.drop_index("idx_reading_events_created", table_name="reading_events")
|
||||
op.drop_index("idx_reading_events_story", table_name="reading_events")
|
||||
op.drop_index("idx_reading_events_profile", table_name="reading_events")
|
||||
op.drop_table("reading_events")
|
||||
op.drop_table("reading_events")
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
"""add pages column to stories
|
||||
|
||||
Revision ID: 0008_add_pages_to_stories
|
||||
Revises: 0007_add_push_configs_and_events
|
||||
Create Date: 2026-01-20
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0008_add_pages_to_stories'
|
||||
down_revision = '0007_add_push_configs_and_events'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('stories', sa.Column('pages', postgresql.JSON(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column('stories', 'pages')
|
||||
"""add pages column to stories
|
||||
|
||||
Revision ID: 0008_add_pages_to_stories
|
||||
Revises: 0007_add_push_configs_and_events
|
||||
Create Date: 2026-01-20
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0008_add_pages_to_stories'
|
||||
down_revision = '0007_add_push_configs_and_events'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('stories', sa.Column('pages', postgresql.JSON(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column('stories', 'pages')
|
||||
|
||||
Reference in New Issue
Block a user