release: v2.0 - 完整功能管理系统
主要功能: - 完整的Flask-Admin后台管理系统 - 网站/标签/新闻管理功能 - 用户登录认证系统 - 科技感/未来风UI设计 - 标签分类系统(取代传统分类) - 详情页面展示 - 数据库迁移脚本 - 书签导入解析工具 技术栈: - Flask + SQLAlchemy - Flask-Admin管理界面 - Bootstrap 4响应式设计 - 用户认证与权限管理 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
25
migrations/make_slug_nullable.py
Normal file
25
migrations/make_slug_nullable.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""修改slug字段为可空的迁移脚本"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 添加项目根目录到系统路径
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app import create_app
|
||||
from models import db
|
||||
from sqlalchemy import text
|
||||
|
||||
# 创建应用上下文
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
# 使用原生SQL修改列属性
|
||||
try:
|
||||
# MySQL语法:修改slug列为可空
|
||||
with db.engine.connect() as connection:
|
||||
connection.execute(text('ALTER TABLE sites MODIFY COLUMN slug VARCHAR(100) NULL'))
|
||||
connection.commit()
|
||||
print("slug field successfully updated to nullable!")
|
||||
except Exception as e:
|
||||
print(f"Migration failed: {str(e)}")
|
||||
print("Note: If the field is already nullable, you can ignore this error.")
|
||||
Reference in New Issue
Block a user