<?php
require_once 'includes/db.php';

$allTables = fetchAll("SHOW TABLES");
$dbName = DB_NAME;
$colName = "Tables_in_$dbName";

foreach ($allTables as $row) {
    $table = $row[$colName];
    try {
        $res = fetch("SHOW CREATE TABLE $table");
        echo "Table: $table\n";
        echo $res['Create Table'] . ";\n\n";
    } catch (Exception $e) {
        echo "Error fetching DDL for $table: " . $e->getMessage() . "\n\n";
    }
}
