You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Flyway 5.0.5 Community command line (behavior also observed in 4.2.0)
Command-line client
Microsoft SQL Server 13.0 (AWS RDS Enterprise SQL Server)
Tested using Flyway 4.1.2, 4.2.0, 5.0.5 using jtds 1.3.1
repros running from OSX, Linux (assume platform independent)
We have a script that performs various tasks, but the problem can be reproduced using a script with one statement to switch database in a beforeMigrate.sql:
-- Switch to using master database
use master
Expected result, with flyway 4.1.2
$ flyway -url=jdbc:jtds:sqlserver://databaseurl:1433/tempdb -schemas=flyway -user=user -password=password -locations=filesystem:./migrations migrate
Flyway 4.1.2 by Boxfuse
Database: jdbc:jtds:sqlserver://databaseurl:1433/tempdb (Microsoft SQL Server 13.0)
SQLServer does not support setting the schema for the current session. Default schema NOT changed to flyway
Successfully validated 0 migrations (execution time 00:00.403s)
Executing SQL callback: beforeMigrate
WARNING: DB: Changed database context to 'master'. (SQL State: 01000 - Error Code: 5701)
Creating Metadata table: [flyway].[schema_version]
Current version of schema [flyway]: << Empty Schema >>
Schema [flyway] is up to date. No migration necessary.
Result with 5.0.5 (and 4.2.0)
$ flyway -url=jdbc:jtds:sqlserver://databaseurl:1433/tempdb -schemas=flyway -user=user -password=password -group=false -table=schema_version -locations=filesystem:./migrations migrate
Flyway Community Edition 5.0.5 by Boxfuse
Database: jdbc:jtds:sqlserver://databaseurl:1433/tempdb (Microsoft SQL Server 13.0)
SQLServer does not support setting the schema for the current session. Default schema NOT changed to flyway
Successfully validated 0 migrations (execution time 00:00.634s)
Executing SQL callback: beforeMigrate
WARNING: DB: Changed database context to 'master'. (SQL State: 01000 - Error Code: 5701)
Creating Schema History table: [tempdb].[flyway].[schema_version]
ERROR:
Script failed
-------------
SQL State : 42000
Error Code : 262
Message : CREATE TABLE permission denied in database 'master'.
Line : 17
Statement : CREATE TABLE [flyway].[schema_version] (
[installed_rank] INT NOT NULL,
[version] NVARCHAR(50),
[description] NVARCHAR(200),
[type] NVARCHAR(20) NOT NULL,
[script] NVARCHAR(1000) NOT NULL,
[checksum] INT,
[installed_by] NVARCHAR(100) NOT NULL,
[installed_on] DATETIME NOT NULL DEFAULT GETDATE(),
[execution_time] INT NOT NULL,
[success] BIT NOT NULL
);
ALTER TABLE [flyway].[schema_version] ADD CONSTRAINT [schema_version_pk] PRIMARY KEY ([installed_rank]);
CREATE INDEX [schema_version_s_idx] ON [flyway].[schema_version] ([success]);
Appears the activities within the callback affect ability to access intended flyway schema and version table. Using user databases other than master returns similar but different errors, for example:
Error Code : 2760
Message : The specified schema name "flyway" either does not exist or you do not have permission to use it.
This may be related to running within a transaction scope #1707 ? Note I can manually run the above schema_version CREATE statements if I qualify them with the database to use as indicated in the log output message, such as:
Flyway 5.0.5 Community command line (behavior also observed in 4.2.0)
Command-line client
Microsoft SQL Server 13.0 (AWS RDS Enterprise SQL Server)
Tested using Flyway 4.1.2, 4.2.0, 5.0.5 using jtds 1.3.1
repros running from OSX, Linux (assume platform independent)
We have a script that performs various tasks, but the problem can be reproduced using a script with one statement to switch database in a beforeMigrate.sql:
Expected result, with flyway 4.1.2
Result with 5.0.5 (and 4.2.0)
Appears the activities within the callback affect ability to access intended flyway schema and version table. Using user databases other than master returns similar but different errors, for example:
This may be related to running within a transaction scope #1707 ? Note I can manually run the above schema_version CREATE statements if I qualify them with the database to use as indicated in the log output message, such as:
The text was updated successfully, but these errors were encountered: