16 lines
374 B
Python
16 lines
374 B
Python
|
|
from app import app
|
||
|
|
from extensions import db
|
||
|
|
import models
|
||
|
|
|
||
|
|
def init():
|
||
|
|
with app.app_context():
|
||
|
|
print("🔧 正在同步数据库架构...")
|
||
|
|
try:
|
||
|
|
db.create_all()
|
||
|
|
print("✅ 数据库表已成功创建或已存在")
|
||
|
|
except Exception as e:
|
||
|
|
print(f"❌ 同步失败: {e}")
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
init()
|