39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""rename_quota_to_credits
|
|
|
|
Revision ID: d551c03861f4
|
|
Revises: 540c970ff890
|
|
Create Date: 2026-05-13 13:01:51.510123
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'd551c03861f4'
|
|
down_revision: Union[str, None] = '540c970ff890'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Rename Table
|
|
op.rename_table('chat_token_quota', 'chat_credit_quota')
|
|
|
|
# Rename Columns in chat_credit_quota
|
|
op.alter_column('chat_credit_quota', 'daily_limit', new_column_name='daily_credit_limit')
|
|
op.alter_column('chat_credit_quota', 'tokens_used_today', new_column_name='credits_used_today')
|
|
op.alter_column('chat_credit_quota', 'total_tokens_ever', new_column_name='total_credits_ever')
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Rename Columns back
|
|
op.alter_column('chat_credit_quota', 'daily_credit_limit', new_column_name='daily_limit')
|
|
op.alter_column('chat_credit_quota', 'credits_used_today', new_column_name='tokens_used_today')
|
|
op.alter_column('chat_credit_quota', 'total_credits_ever', new_column_name='total_tokens_ever')
|
|
|
|
# Rename Table back
|
|
op.rename_table('chat_credit_quota', 'chat_token_quota')
|