refactor: project restructuring - migrate to modular directory layout
- Move root-level docs into docs/ directory - Move config files into config/ directory - Move docker files into docker/ directory - Move test scripts into tests/ directory - Remove .env from tracking (use .env.example as template) - Remove .venv/ from tracking (use requirements.txt) - Add Vue3 frontend app (vue-app/) - Add new routes: upload, user_templates, meeting_minutes, etc. - Add database migrations for prompt_template additions - Fix load_dotenv() to use absolute path for Flask reloader compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
31
scripts/create_favorites_table.py
Normal file
31
scripts/create_favorites_table.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
创建收藏表的数据库迁移脚本
|
||||
"""
|
||||
from src.flask_prompt_master import create_app, db
|
||||
from src.flask_prompt_master.models.favorites import Favorite
|
||||
|
||||
def create_favorites_table():
|
||||
"""创建收藏表"""
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
try:
|
||||
# 创建表
|
||||
db.create_all()
|
||||
print("✅ 收藏表创建成功!")
|
||||
|
||||
# 验证表是否存在
|
||||
from sqlalchemy import inspect
|
||||
inspector = inspect(db.engine)
|
||||
tables = inspector.get_table_names()
|
||||
if 'favorites' in tables:
|
||||
print("✅ 验证成功:favorites表已存在")
|
||||
else:
|
||||
print("❌ 验证失败:favorites表不存在")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ 创建收藏表失败:{str(e)}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_favorites_table()
|
||||
Reference in New Issue
Block a user