Describe the bug
I'm trying to create a new FluentMigration on a Snowflake database. The migration runs, executing the migration commands, but fails at the point of inserting the migration record to the VersionInfo table.
This only appears to happen in v7.0.0 and v7.1.0. The issue does not occur in v6.2.0.
On running the migration in v.7.1.0, the following error is returned:
[14:15:57 ERR] Failed to run Snowflake database migrations for database Snowflake assembly TestProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FluentMigrator.Runner.SnowflakeException: An error occurred executing the following sql:
INSERT INTO dbo.VersionInfo_TestProject (Version, AppliedOn, Description) VALUES (3, CONVERT_TIMEZONE('UTC',CURRENT_TIMESTAMP()), 'Test migration 2 that should not be kept')
The error was Error: SQL compilation error:
Expression type does not match column data type, expecting TIMESTAMP_NTZ(9) but got TIMESTAMP_TZ(9) for column APPLIEDON SqlState: 22000, VendorCode: 2023, QueryId: 01bdecdb-0000-ae6b-0000-2a5d0186c442
The query submitted (taken from Snowflake logs) is:
INSERT INTO dbo.VersionInfo_TestProject (Version, AppliedOn, Description) VALUES (3, CONVERT_TIMEZONE('UTC',CURRENT_TIMESTAMP()), 'Test migration 2 that should not be kept')
In the version table, the AppliedOn column is being created as type Timestamp_NTZ . When inserting a record to this table after a successul migration, the value of AppliedOn is being passed as type Timestamp_TZ.
Suspect this is related to change #1847 released with v7.
Have rolled back to FluentMigrator v6.2.0 and migrations are successful.
To Reproduce
Create a migration on a Snowflake database using FluentMigrator v7.1.0.
The error occurs at the end when inserting the migration record to the VersionInfo table.
The error occurs if both when this is a new VersionInfo table and if VersionInfo was created with an earlier version (e.g. 6.2.0)
Expected behavior
Expect the migration to complete successfully, the VersionInfo table to be created, and a record of the migration to be inserted.
Information (please complete the following information):
- OS: Windows 11
- Platform: dotnet 8
- FluentMigrator version: 7.1.0
- FluentMigrator runner: in-process runner
- Database Management System: Snowflake
- Database Management System Version:
Additional context
Code sample where we run FluentMigrator:
var serviceCollection = new ServiceCollection()
.AddFluentMigratorCore()
.ConfigureRunner(rb => rb
.AddSnowflake()
.WithGlobalCommandTimeout(new TimeSpan(0, 0, 60))
.AsGlobalPreview(false)
.WithVersionTable(metadata)
.WithGlobalConnectionString(dbConnectionString)
.ScanIn(assembly).For.Migrations());
if (detailedLogging)
serviceCollection = serviceCollection.AddLogging(lb => lb.AddFluentMigratorConsole());
var serviceProvider = serviceCollection.BuildServiceProvider(false);
var runner = serviceProvider.GetRequiredService<IMigrationRunner>();
runner.MigrateUp();
Using nuget packages:
- FluentMigrator v7.1.0
- FluentMigrator.Runner v7.1.0
Describe the bug
I'm trying to create a new FluentMigration on a Snowflake database. The migration runs, executing the migration commands, but fails at the point of inserting the migration record to the
VersionInfotable.This only appears to happen in v7.0.0 and v7.1.0. The issue does not occur in v6.2.0.
On running the migration in v.7.1.0, the following error is returned:
The query submitted (taken from Snowflake logs) is:
In the version table, the
AppliedOncolumn is being created as typeTimestamp_NTZ. When inserting a record to this table after a successul migration, the value ofAppliedOnis being passed as typeTimestamp_TZ.Suspect this is related to change #1847 released with v7.
Have rolled back to FluentMigrator v6.2.0 and migrations are successful.
To Reproduce
Create a migration on a Snowflake database using FluentMigrator v7.1.0.
The error occurs at the end when inserting the migration record to the
VersionInfotable.The error occurs if both when this is a new
VersionInfotable and ifVersionInfowas created with an earlier version (e.g. 6.2.0)Expected behavior
Expect the migration to complete successfully, the
VersionInfotable to be created, and a record of the migration to be inserted.Information (please complete the following information):
Additional context
Code sample where we run FluentMigrator:
Using nuget packages: