sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

How to set db config dialect for oracle ?

Open NattNeazys opened this issue 7 years ago • 2 comments
trafficstars

I want to try the migration with oracle , looking into 'migrate.go'. I find this code section: var MigrationDialects = map[string]gorp.Dialect{ "sqlite3": gorp.SqliteDialect{}, "postgres": gorp.PostgresDialect{}, "mysql": gorp.MySQLDialect{Engine: "InnoDB", Encoding: "UTF8"}, "mssql": gorp.SqlServerDialect{}, "oci8": gorp.OracleDialect{}, } i assume that dbconfig should use 'oci8' , but it's not working.

NattNeazys avatar Mar 14 '18 10:03 NattNeazys

Yes, that should be correct. But I have no experience with Oracle, so I can't really help you there.

What I can tell is that for e.g. PostgreSQL you need to explicitly import the database driver:

import (
	"database/sql"

	_ "github.com/lib/pq"
)

Perhaps something similar is needed for the Oracle driver?

rubenv avatar Mar 15 '18 15:03 rubenv

Thank you for your answer. If that is the case then i think i will need to add the driver.
import ( - "github.com/mattn/go-oci8" ) I initially thought that the driver is inherit from 'gorp'. But i will try import the driver explicitly.

NattNeazys avatar Mar 15 '18 16:03 NattNeazys