<?php
$dbPath = __DIR__ . '/wedding_data.db';

try {
    $pdo = new PDO("sqlite:$dbPath");
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    $sqls = [
        "ALTER TABLE video_assets ADD COLUMN play_priority INTEGER DEFAULT 1",
        "ALTER TABLE video_assets ADD COLUMN description TEXT DEFAULT ''"
    ];
    
    foreach ($sqls as $sql) {
        try {
            $pdo->exec($sql);
            echo "✓ 执行成功: $sql\n";
        } catch (PDOException $e) {
            echo "⚠️ 已存在或失败: $sql\n";
            echo "  错误: " . $e->getMessage() . "\n";
        }
    }
    
    // 检查表结构
    echo "\n视频资产表结构:\n";
    $stmt = $pdo->query("PRAGMA table_info(video_assets)");
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo "  {$row['name']} ({$row['type']}) DEFAULT {$row['dflt_value']}\n";
    }
    
} catch (PDOException $e) {
    die("✗ 失败: " . $e->getMessage() . "\n");
}
?>