-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Error:
no .gcorm schema files found
Fixes:
- Pass
--schema schema. - Create
schema/schema.gcorm. - Set
schemaRootsingco.config.yaml. - Check that files use the
.gcormextension.
If both schema/ and prisma/ exist, GCORM does not guess.
Fix:
gco validate --schema schemaor:
schemaRoots:
- schemaError:
datasource url uses env("DATABASE_URL"), but DATABASE_URL is not set
Fix:
export DATABASE_URL='postgresql://postgres:postgres@localhost:5432/app?sslmode=disable'or pass:
gco db push --url "$DATABASE_URL"If your application fails to open a database driver, import the driver package.
PostgreSQL:
import _ "github.com/jackc/pgx/v5/stdlib"MySQL:
import _ "github.com/go-sql-driver/mysql"SQLite:
import _ "modernc.org/sqlite"PostgreSQL is the default generated client dialect. For MySQL and SQLite, pass the dialect explicitly:
c := client.New(db, client.WithDialect("mysql"))
c := client.New(db, client.WithDialect("sqlite"))Use parseTime=true in MySQL DSNs:
user:password@tcp(localhost:3306)/app?parseTime=true
Local PostgreSQL often needs:
sslmode=disable
Example:
postgresql://postgres:postgres@localhost:5432/app?sslmode=disable
Use a file URL that allows creation:
file:./data/app.db?cache=shared&mode=rwc
Ensure the parent directory exists.
gco db push refuses destructive changes unless --force is used.
Fix:
- Review the schema change.
- Back up important data.
- Run:
gco db push --forceCurrent migration commands generate or inspect migration files. They do not currently execute SQL against a live database.
Use gco db push for direct development synchronization, or apply reviewed SQL
through your deployment system.
The current gco introspect command detects provider information and prints
guidance, but full live database introspection is not implemented there.
gco db push still performs internal introspection for schema comparison.
After changing .gcorm files:
gco validate
gco generate
go test ./...If imports fail, check the generator output path and Go module import path.