Closed suntereo closed 8 months ago
Something is not correct with point 2. It should not allow 2 keys that only differ by casing to be inserted onto the table when the column is case insensitive. I need to revisit this ticket.
UPDATE: There is an issue, but I was on the wrong track with trying to explain it. Here's the correct way to explain it: https://github.com/tedd/Tedd.ShortUrl/issues/36
First and foremost, I would like to extend my sincere thanks and appreciation for developing the Tedd.ShortUrl package! Here's an important issue I found.
Description
When using
dbContext.Database.Migrate()
to create tables in Tedd.ShortUrl, theUrls.Key
column is not created as case sensitive. This leads to an issue where different keys that only vary in letter casing return the same record from the SQL database. For example,KzZzkh
andkzZzkh
are treated as the same key, which is not intended behavior.Steps to Reproduce
dbContext.Database.Migrate()
to create the database schema.Urls
table with keys that differ only in their casing (e.g.,KzZzkh
andkzZzkh
).Current Behavior
The SQL database treats keys
KzZzkh
andkzZzkh
as identical due to case insensitivity in theUrls.Key
column.Expected Behavior
The database should treat
KzZzkh
andkzZzkh
as distinct keys due to their different casings.Potential Solution
I was able to resolve this issue manually using the following SQL script:
Additionally, to integrate this solution into the
migrationBuilder.CreateTable
call, the following code can be added after theCreateTable
call:This alteration ensures that the 'Key' column is created with case sensitivity, which is not the default behavior in MSSQL.