Closed tjementum closed 6 days ago
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@tjementum maybe there could be a helper method on the strongly typed id to provide the table.Column<string>("varchar(33)", nullable: false),
based on the prefix?
This is a temporary fix.
I deliberately keep EF Migrations like this, so one could still use the EF Migrations tools to generate the migrations.
I have a working prototype of database migrations using a declarative way of maintaining the database schema.
Summary & Motivation
Switch ID columns from
char(xx)
tovarchar(32)
to eliminate issues with blank spaces when saving strongly typed IDs likeusr_01JA5QZTCP69B5T916WF1TSQG8
(30 characters). Developers often forget to adjust column sizes when copying migration code, causing unnecessary padding inchar
columns. Defaulting tovarchar(32)
provides flexibility for IDs up to 32 characters without blank space issues and supports strongly typed IDs with up to 5-character prefixes. Thesignup
ID column remainsvarchar(33)
due to the lack of a suitable 5-character prefix for "signup."Downstream Projects
Update all Entity Framework database migrations to replace
char(xx)
withvarchar(32)
for ID columns. Note that this is a non-breaking change, as the original EF Core migration is updated instead of creating a new one, ensuring the existing schema remains compatible.Checklist