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
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
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
Close inactive issues / close-issues (push) Has been cancelled
59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
"""add credits
|
|
|
|
Revision ID: a959f8a63245
|
|
Revises: 3781e22d8b01
|
|
Create Date: 2025-03-04 19:45:49.438656
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
from sqlalchemy.dialects import sqlite
|
|
|
|
import open_webui.internal.db
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "a959f8a63245"
|
|
down_revision: Union[str, None] = "3781e22d8b01"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"credit",
|
|
sa.Column("id", sa.String(), nullable=False),
|
|
sa.Column("user_id", sa.String(), nullable=False),
|
|
sa.Column("credit", sa.Numeric(precision=24, scale=12), nullable=True),
|
|
sa.Column("updated_at", sa.BigInteger(), nullable=True),
|
|
sa.Column("created_at", sa.BigInteger(), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("user_id"),
|
|
)
|
|
op.add_column("model", sa.Column("price", sa.JSON(), nullable=True))
|
|
op.create_table(
|
|
"credit_log",
|
|
sa.Column("id", sa.String(), nullable=False),
|
|
sa.Column("user_id", sa.String(), nullable=False),
|
|
sa.Column("credit", sa.Numeric(precision=24, scale=12), nullable=True),
|
|
sa.Column("detail", sa.JSON(), nullable=True),
|
|
sa.Column("created_at", sa.BigInteger(), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_credit_log_user_id"), "credit_log", ["user_id"], unique=False
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table("credit")
|
|
op.drop_column("model", "price")
|
|
op.drop_index(op.f("ix_credit_log_user_id"), table_name="credit_log")
|
|
op.drop_table("credit_log")
|
|
# ### end Alembic commands ###
|