Skip to content

Fix Snowflake migrations for #2113#2224

Merged
jzabroski merged 1 commit into
fluentmigrator:mainfrom
scooby359:Fix-Snowflake-Migrations-#2113
Jan 20, 2026
Merged

Fix Snowflake migrations for #2113#2224
jzabroski merged 1 commit into
fluentmigrator:mainfrom
scooby359:Fix-Snowflake-Migrations-#2113

Conversation

@scooby359

Copy link
Copy Markdown

Changed mapping for SystemMethods.CurrentDateTime to CURRENT_TIMESTAMP() and SystemMethods.CurrentUTCDateTime to SYSDATE() in the Snowflake generator. Updated all related unit tests.
@github-actions

Copy link
Copy Markdown

Test Results

    2 files  ±0      2 suites  ±0   39s ⏱️ ±0s
5 463 tests ±0  5 131 ✅ ±0  332 💤 ±0  0 ❌ ±0 
5 947 runs  ±0  5 351 ✅ ±0  596 💤 ±0  0 ❌ ±0 

Results for commit 22b5037. ± Comparison against base commit d698338.

@scooby359

Copy link
Copy Markdown
Author

Fix for #2113

Haven't contributed to this project before and was looking for contribution guidelines for the project, but all links I could find are broken.

I've reverted the previous changes made in error, applied the fix as identified, and updated tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request reverts changes from PR #2149 to fix Snowflake migrations related to issue #2113. The changes restore the mapping of SystemMethods.CurrentDateTime to CURRENT_TIMESTAMP() and remap SystemMethods.CurrentUTCDateTime to SYSDATE(). However, this introduces a critical semantic issue with UTC datetime handling.

Changes:

  • Restored SystemMethods.CurrentDateTime mapping from SYSDATE() back to CURRENT_TIMESTAMP() in the Snowflake quoter
  • Changed SystemMethods.CurrentUTCDateTime mapping from CONVERT_TIMEZONE('UTC',CURRENT_TIMESTAMP()) to SYSDATE()
  • Updated all related unit tests to match the new function mappings

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/FluentMigrator.Runner.Snowflake/Generators/Snowflake/SnowflakeQuoter.cs Reverted CurrentDateTime to CURRENT_TIMESTAMP() and mapped CurrentUTCDateTime to SYSDATE(), but this mapping is semantically incorrect as SYSDATE() returns local session time, not UTC
test/FluentMigrator.Tests/Unit/Generators/Snowflake/SnowflakeQuoterTests.cs Updated test expectations to match new mappings, but now validates incorrect behavior for CurrentUTCDateTime
test/FluentMigrator.Tests/Unit/Generators/Snowflake/SnowflakeGeneratorTests.cs Correctly updated test expectations for CurrentDateTime to use CURRENT_TIMESTAMP()
test/FluentMigrator.Tests/Unit/Generators/Snowflake/SnowflakeColumnTests.cs Correctly updated test expectations for CurrentDateTime to use CURRENT_TIMESTAMP()

@jzabroski jzabroski added this to the 8.1.0 milestone Jan 20, 2026
@jzabroski

Copy link
Copy Markdown
Collaborator

@copilot In your review, did you consider the following facts:

  1. https://github.com/fluentmigrator/fluentmigrator/blob/d698338019568ccb8b31006654aa7040321636a6/src/FluentMigrator.Runner.Core/Versioning/VersionMigration.cs#L163C46-L163C65 uses DateTime data type
  2. Default SnowflakeTypeMap maps that to TIMESTAMP_NTZ

The change from @scooby359 appears to be correct in light of the fact AppliedOn does not preserve the timezone information. While I agree that it should ideally capture the TimeZone, the next best alternative is that the application always writes the value in UTC time. Do you agree?

@jzabroski

Copy link
Copy Markdown
Collaborator

@scooby359 It looks like I can't interact with Copilot on other people's PRs. But I think your analysis is correct, and my rebuttal to Copilot will merely serve as a log as to what I thought in case somehow we missed something else. Will publish 8.1 today.

@jzabroski
jzabroski merged commit 06fb0de into fluentmigrator:main Jan 20, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants