#!/usr/bin/env python3 import os import sys import django os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'diary_system.settings') sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'backend')) django.setup() from django.core.management import call_command call_command('makemigrations', 'diary') call_command('migrate') print("✅ 数据库迁移完成")