49 lines
1.9 KiB
Python
49 lines
1.9 KiB
Python
"""add site_friend table
|
|
|
|
Revision ID: 971bc54196ea
|
|
Revises: 1a4b7cd9005e
|
|
Create Date: 2026-09-06 08:33:13.812008
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '971bc54196ea'
|
|
down_revision = '1a4b7cd9005e'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('site_friend',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='友情链接ID'),
|
|
sa.Column('title', sa.String(length=100), nullable=False, comment='名称'),
|
|
sa.Column('url', sa.String(length=255), nullable=False, comment='链接'),
|
|
sa.Column('logo', sa.String(length=255), nullable=True, comment='Logo / favicon'),
|
|
sa.Column('description', sa.String(length=255), nullable=True, comment='简介'),
|
|
sa.Column('category', sa.String(length=50), nullable=True, comment='分组'),
|
|
sa.Column('sort', sa.Integer(), nullable=True, comment='排序'),
|
|
sa.Column('enable', sa.Integer(), nullable=True, comment='状态(1启用,0关闭)'),
|
|
sa.Column('is_external', sa.Integer(), nullable=True, comment='是否外链'),
|
|
sa.Column('create_by', sa.String(length=50), nullable=True, comment='创建者'),
|
|
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
|
|
sa.Column('update_at', sa.DateTime(), nullable=True, comment='更新时间'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('site_friend', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_site_friend_category'), ['category'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('site_friend', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_site_friend_category'))
|
|
|
|
op.drop_table('site_friend')
|
|
# ### end Alembic commands ###
|