Commit b4d2225
feat(schema): live DB schema introspection for Postgres, MySQL, SQLite (#448)
* feat(schema): live DB schema introspection for Postgres, MySQL, SQLite (#448)
Adds pkg/schema/db with Loader interface and DatabaseSchema/Table/Column/
Index/ForeignKey types for querying live database schema metadata.
Dialect-specific implementations:
- pkg/schema/postgres: information_schema + pg_catalog queries
- pkg/schema/mysql: information_schema queries
- pkg/schema/sqlite: PRAGMA commands (pure Go, no cgo)
Also adds gosqlx.LoadSchema() top-level convenience wrapper and
integration tests using testcontainers-go v0.32.0 for Postgres/MySQL.
SQLite tests run without Docker and always pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(schema): resolve lint errcheck and bump vulnerable transitive deps
Fix 12 errcheck lint errors by wrapping defer rows.Close() calls to
explicitly discard the error. Bump testcontainers-go v0.32.0 -> v0.41.0,
containerd v1.7.18 -> v1.7.30, docker v27.0.3 -> v28.5.2,
x/crypto v0.22.0 -> v0.48.0, grpc v1.59.0 -> v1.67.0 to resolve
CVE-2024-25621, CVE-2024-40635, CVE-2025-64329, CVE-2024-41110,
CVE-2024-45337, CVE-2025-22869, CVE-2025-47914, CVE-2025-58181,
CVE-2026-33186.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(schema): stabilize testcontainers tests and allow docker GHSA
- Add testing.Short() guard to postgres/mysql loader tests so they skip
in the Race Detector job (which runs with -short)
- Replace wait.ForListeningPort with wait.ForLog for postgres container
to wait until the database is fully ready (fixes EOF on create tables)
- Add db.Ping retry loop after container start for both postgres and mysql
to handle the window between port-listen and query-ready
- Allow GHSA-x744-4wpc-v9h2 (docker AuthZ bypass) in dependency review;
transitive dep via testcontainers-go with no upstream fix available
Closes race-detector and macOS test failures on PR #471.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(schema): skip testcontainers tests when Docker is unavailable
Add runtime Docker availability check (docker info) before attempting
to create testcontainers. This prevents test failures on macOS CI
runners that don't have Docker installed, without requiring -short flag.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini-2655.local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent a7ce3aa commit b4d2225
File tree
14 files changed
+1605
-13
lines changed- .github/workflows
- pkg
- gosqlx
- schema
- db
- mysql
- postgres
- sqlite
14 files changed
+1605
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
15 | 23 | | |
16 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
17 | 44 | | |
| 45 | + | |
18 | 46 | | |
19 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
20 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
21 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
22 | 74 | | |
23 | 75 | | |
24 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
25 | 96 | | |
0 commit comments