43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
"""add table article
|
|
|
|
Revision ID: 7de2da2e824b
|
|
Revises: dfad2ce9d3b7
|
|
Create Date: 2026-02-15 15:11:54.662014
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '7de2da2e824b'
|
|
down_revision: Union[str, Sequence[str], None] = 'dfad2ce9d3b7'
|
|
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_article',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='自动递增的唯一内容ID'),
|
|
sa.Column('title', sa.String(length=256), nullable=False, comment='标题'),
|
|
sa.Column('keywords', sa.Text(), nullable=True, 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('used', sa.Boolean(), nullable=False, comment='是否已被使用'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_t_article_title'), 't_article', ['title'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_t_article_title'), table_name='t_article')
|
|
op.drop_table('t_article')
|
|
# ### end Alembic commands ###
|