rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.18k stars 270 forks source link

use godror instead of oci8 & remove -tags oracle #169

Closed gunsluo closed 4 years ago

gunsluo commented 4 years ago

Hi, @rubenv

I use godror(oracle driver) instead of oci8.

Advantages:

  1. Don't configure pkg-config
  2. Compiling sql-migrate does not depend on oracle office client. The user can uses the same version to generate postgres & oracle
  3. input LD_LIBRARY_PATH= to configure oracle office client at runtime.

please view.

rubenv commented 4 years ago

Hmmm, this is a problem, as it's a C dependency.

It effectively forces everyone to use cgo:

$ CGO_ENABLED=0 go build .
# github.com/godror/godror
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:452:53: undefined: VersionInfo
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:461:53: undefined: VersionInfo
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:479:19: undefined: VersionInfo
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:480:19: undefined: VersionInfo
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:481:30: undefined: ObjectType
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:482:31: undefined: Event
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:482:42: undefined: SubscriptionOption
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:482:64: undefined: Subscription
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:483:10: undefined: StartupMode
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:484:11: undefined: ShutdownMode
../../../../pkg/mod/github.com/godror/godror@v0.13.3/orahlp.go:484:11: too many errors

That wasn't a requirement previously (and I know of projects relying on this), so it's not something we can require now.

gunsluo commented 4 years ago

Hi, @rubenv I run the following command and get this error. I check go-sqlite3 should be enable CGO_ENABLED

CGO_ENABLED=0 GO111MODULE=on go build .
# github.com/mattn/go-sqlite3
../../../../../pkg/mod/github.com/mattn/go-sqlite3@v1.12.0/sqlite3_opt_preupdate.go:12:16: undefined: SQLiteConn
../../../../../pkg/mod/github.com/mattn/go-sqlite3@v1.12.0/sqlite3_opt_preupdate_omit.go:19:10: undefined: SQLiteConn