Skip to content

Conversation

ronnyek
Copy link
Collaborator

@ronnyek ronnyek commented May 23, 2025

EFCore was passing 'NULL' in as a string for schema when providing a check to check whether the __EFMigrationsHistory table existed.

At the time the SQL is executed, the context should already be set to the target schema, and theoretically dont ever need to provide the schema criteria.

Fixed the SQL generation to include the schema filter only when the schema provided meets following criteria.

  • Schema is not null
  • Schema is not an empty or "whitespace" string
  • Schema value is not NULL

I ran all unit tests, and everything passes. Verified with a sample test app that only unapplied migrations are applied.

@ronnyek ronnyek requested a review from NikTJ777 May 23, 2025 18:09
Copy link
Contributor

@NikTJ777 NikTJ777 left a comment

Choose a reason for hiding this comment

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

Look good!

I'm not entirely clear of the purpose of the '$' in: $"" AND "SCHEMA"= "{schemaName}", but I am happy it is the correct syntax.

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.

2 participants