import { NextResponse } from 'next/server'
import { initDatabase } from '@/lib/db'

// 初始化数据库表
export async function POST() {
  try {
    await initDatabase()
    return NextResponse.json({ success: true, message: '数据库初始化成功' })
  } catch (error: any) {
    console.error('Database init error:', error)
    return NextResponse.json({ 
      success: false, 
      error: error.message || '数据库初始化失败' 
    }, { status: 500 })
  }
}
