isMySQLVersionOK checks if the mysqld --version output indicates MySQL 9+. Example version string: "/usr/sbin/mysqld Ver 8.0.44-0ubuntu0.24.04.2 ..."
(versionOutput string)
| 89 | // isMySQLVersionOK checks if the mysqld --version output indicates MySQL 9+. |
| 90 | // Example version string: "/usr/sbin/mysqld Ver 8.0.44-0ubuntu0.24.04.2 ..." |
| 91 | func isMySQLVersionOK(versionOutput string) bool { |
| 92 | // Look for "Ver X.Y.Z" pattern |
| 93 | fields := strings.Fields(versionOutput) |
| 94 | for i, f := range fields { |
| 95 | if strings.EqualFold(f, "Ver") && i+1 < len(fields) { |
| 96 | ver := strings.Split(fields[i+1], ".") |
| 97 | if len(ver) > 0 { |
| 98 | major := strings.TrimLeft(ver[0], "0") |
| 99 | if major == "" { |
| 100 | return false |
| 101 | } |
| 102 | return major[0] >= '9' |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | return false |
| 107 | } |
| 108 | |
| 109 | // pgBaseDir returns the sqlc-specific directory where PostgreSQL is installed, |
| 110 | // using the user's cache directory (~/.cache/sqlc/postgresql on Linux). |