false, 'error' => 'Migration file not found.']; } $sql = file_get_contents($sql_file); $pdo->exec($sql); return ['success' => true, 'message' => 'Database setup and seeding completed successfully.']; } catch (PDOException $e) { return ['success' => false, 'error' => 'Database error: ' . $e->getMessage()]; } } // If this script is run directly from the command line, execute the migrations. if (php_sapi_name() === 'cli') { $result = run_migrations(); echo $result['message'] ?? $result['error']; echo "\n"; }