<?php
$db = new PDO('sqlite:../db/rapor.db');
$newFields = range(16, 30);

try {
    foreach ($newFields as $fieldNumber) {
        $fieldName = 'f' . $fieldNumber;
        $sql = "ALTER TABLE nilai_formatif ADD COLUMN $fieldName TEXT (255)";
        $db->exec($sql);
        echo "Added column $fieldName successfully.\n";
    }
    echo "All columns added successfully.";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}

try {
    // SQL statement to add 'materi_id' column to the 'tp' table
    $sql = "ALTER TABLE tujuan_pembelajaran ADD COLUMN materi_id INTEGER";
    $db->exec($sql);
    echo "Column 'materi_id' added successfully.";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
