45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
"""create table source_content
|
|
|
|
Revision ID: fc8b7693c66b
|
|
Revises:
|
|
Create Date: 2026-02-14 19:07:21.557137
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'fc8b7693c66b'
|
|
down_revision: Union[str, Sequence[str], None] = None
|
|
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_source_content',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='自动递增的唯一内容ID'),
|
|
sa.Column('link', sa.String(length=2048), nullable=False, comment='链接'),
|
|
sa.Column('platform', sa.String(length=32), 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_source_content_link'), 't_source_content', ['link'], unique=False)
|
|
op.create_index('link', 't_source_content', ['link'], unique=True)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index('link', table_name='t_source_content')
|
|
op.drop_index(op.f('ix_t_source_content_link'), table_name='t_source_content')
|
|
op.drop_table('t_source_content')
|
|
# ### end Alembic commands ###
|