feat:精简
Some checks failed
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Python CI / Format Backend (3.11.x) (push) Has been cancelled
Python CI / Format Backend (3.12.x) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda126-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-slim-images (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
Some checks failed
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Python CI / Format Backend (3.11.x) (push) Has been cancelled
Python CI / Format Backend (3.12.x) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda126-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-slim-images (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
This commit is contained in:
@@ -55,19 +55,22 @@ def upgrade():
|
||||
"subscription_usage_log",
|
||||
sa.Column("id", sa.String(255), primary_key=True),
|
||||
sa.Column("user_id", sa.String(255), nullable=False),
|
||||
sa.Column("subscription_id", sa.String(255), nullable=False),
|
||||
sa.Column("plan_id", sa.String(255), nullable=False),
|
||||
sa.Column("model_id", sa.String(255), nullable=True),
|
||||
sa.Column("chat_id", sa.String(255), nullable=True),
|
||||
sa.Column("message_id", sa.String(255), nullable=True),
|
||||
sa.Column("period_start", sa.BigInteger(), nullable=False),
|
||||
sa.Column("period_end", sa.BigInteger(), nullable=False),
|
||||
sa.Column("message_count", sa.Integer(), default=1),
|
||||
sa.Column("created_at", sa.BigInteger(), nullable=True),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_subscription_usage_log_user_period",
|
||||
"ix_subscription_usage_log_user_id",
|
||||
"subscription_usage_log",
|
||||
["user_id", "period_start", "period_end"],
|
||||
["user_id"],
|
||||
)
|
||||
op.create_index(
|
||||
"ix_subscription_usage_log_created_at",
|
||||
"subscription_usage_log",
|
||||
["created_at"],
|
||||
)
|
||||
|
||||
# subscription_redemption_code table
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
"""update redemption_code table for subscription system
|
||||
|
||||
Revision ID: subscription_002
|
||||
Revises: subscription_001
|
||||
Create Date: 2026-01-14
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "subscription_002"
|
||||
down_revision: Union[str, None] = "subscription_001"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add new columns to redemption_code table
|
||||
conn = op.get_bind()
|
||||
inspector = sa.inspect(conn)
|
||||
columns = [col["name"] for col in inspector.get_columns("redemption_code")]
|
||||
|
||||
if "redemption_type" not in columns:
|
||||
op.add_column(
|
||||
"redemption_code",
|
||||
sa.Column("redemption_type", sa.String(), server_default="duration"),
|
||||
)
|
||||
|
||||
if "plan_id" not in columns:
|
||||
op.add_column(
|
||||
"redemption_code",
|
||||
sa.Column("plan_id", sa.String(), nullable=True),
|
||||
)
|
||||
|
||||
if "duration_days" not in columns:
|
||||
op.add_column(
|
||||
"redemption_code",
|
||||
sa.Column("duration_days", sa.Integer(), nullable=True),
|
||||
)
|
||||
|
||||
if "upgrade_days" not in columns:
|
||||
op.add_column(
|
||||
"redemption_code",
|
||||
sa.Column("upgrade_days", sa.Integer(), nullable=True),
|
||||
)
|
||||
|
||||
# remove old column if exists
|
||||
if "upgrade_expires_at" in columns:
|
||||
op.drop_column("redemption_code", "upgrade_expires_at")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("redemption_code", "upgrade_days")
|
||||
op.drop_column("redemption_code", "duration_days")
|
||||
op.drop_column("redemption_code", "plan_id")
|
||||
op.drop_column("redemption_code", "redemption_type")
|
||||
Reference in New Issue
Block a user