Convention
Every table in a module's `app_` schema must start with `<module_id>_`. This prevents collisions when multiple modules share the same schema (e.g., two modules both creating `items`).
Proposed helper
```go
// In a module's integration test:
func TestTablePrefix(t *testing.T) {
ms.ValidateTablePrefix(t)
}
```
Implementation queries `information_schema.tables` after migrations run:
```sql
SELECT table_name FROM information_schema.tables
WHERE table_schema = current_schema()
AND table_name NOT LIKE $1 || '_%'
```
Where `$1` is `Config.ID`. Any rows returned → test fails with the offending table names.
Scope
- Add `ValidateTablePrefix(t *testing.T)` to the SDK (receiver method on `*Module` + package-level wrapper).
- Requires a live Postgres connection — this is an integration-test helper, not a unit test.
- Should skip gracefully if no DB is configured (`skipIfNoDB` pattern).
Files
- `internal/core/db.go` or a new `internal/core/validate.go`
- Test in `internal/core/db_test.go` or `internal/core/validate_test.go`
Context
Template SQL updated to use `template_items` convention in PR #87. Docs updated. This issue adds automated enforcement.
Convention
Every table in a module's `app_` schema must start with `<module_id>_`. This prevents collisions when multiple modules share the same schema (e.g., two modules both creating `items`).
Proposed helper
```go
// In a module's integration test:
func TestTablePrefix(t *testing.T) {
ms.ValidateTablePrefix(t)
}
```
Implementation queries `information_schema.tables` after migrations run:
```sql
SELECT table_name FROM information_schema.tables
WHERE table_schema = current_schema()
AND table_name NOT LIKE $1 || '_%'
```
Where `$1` is `Config.ID`. Any rows returned → test fails with the offending table names.
Scope
Files
Context
Template SQL updated to use `template_items` convention in PR #87. Docs updated. This issue adds automated enforcement.