PDO::ERRMODE_EXCEPTION, ]); // Create the database $pdo->exec('CREATE DATABASE IF NOT EXISTS '.DB_NAME); // Now connect to the newly created database $pdo = db(); // Execute the initial schema $sql = file_get_contents('db/migrations/001_initial_schema.sql'); $pdo->exec($sql); echo "Database setup completed successfully."; } catch (PDOException $e) { die("Database setup failed: " . $e->getMessage()); }