Skip to content

refactor(dal): rename tokens.user_name column to tokens.user_id (stores Guid, not name) #340

@Vasar007

Description

@Vasar007

Captured as a phase-02 review follow-up (IN-01 finding in .planning/phases/02-test-coverage/02-REVIEW.md and 02-REVIEWS.md). Backlog Phase 999.4 in ROADMAP.md.

Problem

RefreshTokenDbInfo declares its FK-to-user column as [Column(\"user_name\")] but stores a Guid user ID:

[Required]
[Column(\"user_name\")]
internal Guid UserId { get; }

The column name semantically says "user name" (string) but the type and content are a Guid (user ID). This is a pre-existing naming error on master, faithfully copied into the 02-09 raw-SQL schema bootstrap (DbCollectionFixture.ApplySchemaAsync creates user_name uuid NOT NULL).

No behavioral defect — purely a confusion-inducing schema label. Surfaces when reading the schema in pgAdmin, when authoring future EF migrations, and when the column name appears in logs / error messages.

Acceptance Criteria

  • Rename [Column(\"user_name\")][Column(\"user_id\")] in RefreshTokenDbInfo
  • Add an EF Core migration that renames the column in production (and the raw-SQL bootstrap in DbCollectionFixture should be updated to match)
  • All existing tests should pass without functional changes
  • Document the rename in Docs/Testing/Coverage/ if any schema-aware tests reference the old name

Why deferred

EF Core migration generation is currently blocked on a ProjectVDbContext model-validation issue documented in 02-09-dal-integration-testcontainers-SUMMARY.md (Plan 02-09 fell back to raw-SQL CREATE TABLE in the test fixture). Once migration generation is unblocked, this rename is the natural first migration to bundle in.

Related

  • Phase 2 review: .planning/phases/02-test-coverage/02-REVIEW.md (IN-01)
  • Phase 2 review summary: .planning/phases/02-test-coverage/02-REVIEWS.md
  • Migration blocker: .planning/phases/02-test-coverage/02-09-dal-integration-testcontainers-SUMMARY.md

Metadata

Metadata

Assignees

Labels

area: Core LibraryRelated tot the core librarytype: Code MaintenanceNew feature/requirement which is targeting on improve architecture, realization and code style

Projects

Status

To do

Relationships

None yet

Development

No branches or pull requests

Issue actions