All checks were successful
Gitea Actions Demo / deploy (push) Successful in 14s
45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
"""create table t_script
|
|
|
|
Revision ID: 330873df4e1d
|
|
Revises: 4b57e6113ae1
|
|
Create Date: 2025-11-20 22:15:57.197011
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '330873df4e1d'
|
|
down_revision: Union[str, Sequence[str], None] = '4b57e6113ae1'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('t_script',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='自动递增的唯一内容ID'),
|
|
sa.Column('project', sa.String(length=64), nullable=False, comment='项目名称'),
|
|
sa.Column('subject', sa.String(length=256), nullable=False, comment='主题'),
|
|
sa.Column('content', sa.Text(), nullable=True, comment='内容'),
|
|
sa.Column('create_time', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False, comment='创建时间'),
|
|
sa.Column('update_time', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False, comment='更新时间'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_t_script_project'), 't_script', ['project'], unique=False)
|
|
op.create_index('ux_project_subject', 't_script', ['project', 'subject'], unique=True)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index('ux_project_subject', table_name='t_script')
|
|
op.drop_index(op.f('ix_t_script_project'), table_name='t_script')
|
|
op.drop_table('t_script')
|
|
# ### end Alembic commands ###
|