modify scripts

This commit is contained in:
2025-11-10 15:22:45 +08:00
parent 28124c1bff
commit bd6e1b6ed8
4 changed files with 192 additions and 2 deletions

View File

@ -0,0 +1,70 @@
"""Auto update from resources
Revision ID: 0b2c66f54410
Revises: 758b3971a51e
Create Date: 2025-11-10 15:21:58.323573
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '0b2c66f54410'
down_revision: Union[str, Sequence[str], None] = '758b3971a51e'
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('clm_keywords',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='主键ID'),
sa.Column('words', sa.String(length=512), nullable=True, comment='关键词(唯一)'),
sa.Column('groups', sa.Text(), nullable=True, comment='关键词分组'),
sa.Column('tags', sa.Text(), nullable=True, comment='标签'),
sa.Column('index_count', sa.Integer(), nullable=True, comment='关联索引数量'),
sa.Column('created_at', sa.DateTime(), nullable=True, comment='创建时间(本地时间)'),
sa.Column('updated_at', sa.DateTime(), nullable=True, comment='更新时间(本地时间)'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('words')
)
op.create_table('sis',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='主键ID'),
sa.Column('plate_name', sa.Text(), nullable=True, comment='板块名称'),
sa.Column('title', sa.Text(), nullable=True, comment='标题'),
sa.Column('url', sa.String(length=512), nullable=True, comment='资源链接(唯一)'),
sa.Column('size_text', sa.Text(), nullable=True, comment='大小文本描述'),
sa.Column('size_gb', sa.Float(), nullable=True, comment='大小GB'),
sa.Column('update_date', sa.Text(), nullable=True, comment='更新日期'),
sa.Column('created_at', sa.DateTime(), nullable=True, comment='创建时间(本地时间)'),
sa.Column('updated_at', sa.DateTime(), nullable=True, comment='更新时间(本地时间)'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('url')
)
op.create_table('clm_keywords_index',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='主键ID'),
sa.Column('words_id', sa.Integer(), nullable=True, comment='关键词ID外键'),
sa.Column('index_id', sa.Integer(), nullable=True, comment='索引ID外键'),
sa.Column('wid_iid', sa.String(length=255), nullable=True, comment='关键词与索引的关联标识'),
sa.Column('tags', sa.Text(), nullable=True, comment='关联标签'),
sa.Column('created_at', sa.DateTime(), nullable=True, comment='创建时间(本地时间)'),
sa.Column('updated_at', sa.DateTime(), nullable=True, comment='更新时间(本地时间)'),
sa.ForeignKeyConstraint(['index_id'], ['clm_index.id'], ),
sa.ForeignKeyConstraint(['words_id'], ['clm_keywords.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('wid_iid')
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('clm_keywords_index')
op.drop_table('sis')
op.drop_table('clm_keywords')
# ### end Alembic commands ###