-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
When using a default DB schema other than dbo, the ensureVersionTable() method errors.
Steps to Reproduce
Steps to reproduce the behavior:
- Create a user with default schema other than
dbo:CREATE USER foo WITH PASSWORD = 'pw', DEFAULT_SCHEMA = [my_schema]; - Open connection to database:
dbDriver, err := sqlserver.WithInstance(db, &sqlserver.Config{SchemaName: "my_schema",MigrationsTable: "schema_migrations",}) - When trying to open the connection a second time, the error occurs.
Expected Behavior
The method should either check for the version table in the given schema name OR always create the version table in the dbo schema.
Migrate Version
v4.15.2
Loaded Source Drivers
n.a
Loaded Database Drivers
sqlserver
Go Version
go1.19.2 darwin/arm64
Stacktrace
could not load migrations: could not create migration: could not create DB driver from instance: mssql: There is already an object named 'schema_migrations' in the database. in line 0: IF NOT EXISTS
(SELECT *
FROM sysobjects
WHERE id = object_id(N'[dbo].[schema_migrations]')
AND OBJECTPROPERTY(id, N'IsUserTable') = 1
)
CREATE TABLE schema_migrations ( version BIGINT PRIMARY KEY NOT NULL, dirty BIT NOT NULL );
Metadata
Metadata
Assignees
Labels
No labels