Skip to content

Feature: Add deletedAt soft-delete column to accounts table (#81)#270

Open
Ummi-001 wants to merge 1 commit into
bridgelet-org:mainfrom
Ummi-001:feature/issue-81-deleted-at-migration
Open

Feature: Add deletedAt soft-delete column to accounts table (#81)#270
Ummi-001 wants to merge 1 commit into
bridgelet-org:mainfrom
Ummi-001:feature/issue-81-deleted-at-migration

Conversation

@Ummi-001

Copy link
Copy Markdown
Contributor

Closes #181
Closes #182
Closes #183
Closes #184

What this does

  • Added @DeleteDateColumn({ type: 'timestamp', nullable: true }) deletedAt: Date | null; to Account entity, with a matching @Index('IDX_accounts_deletedAt', ['deletedAt']).
  • New migration 1718100008000-AddDeletedAtToAccountsTable.ts adds the deletedAt column and index, with a down() rollback.
  • AccountsService.findAll()'s query builder now explicitly filters account.deletedAt IS NULL (query builders don't get TypeORM's automatic soft-delete filtering the way repository find/findOne calls do).
  • ClaimRedemptionProvider's pessimistic-lock query (used during claim redemption) now also filters out soft-deleted accounts, so a soft-deleted account can never be claimed.
  • Updated/fixed existing unit tests in accounts.service.spec.ts and claim-redemption.provider.spec.ts to mock andWhere and assert the new filtering behavior. Added a new test case for the soft-delete filter in findAll.
  • Updated migrations.integration.spec.ts's expected migration count from 8 to 9.

Known issue — flagging for maintainer review

The full integration test suite (migrations.integration.spec.ts) has one assertion, expect(result.schemaInSync).toBe(true), that is currently failing after this change. This test spins up a real embedded Postgres, runs all migrations, and compares the resulting schema against TypeORM's entity metadata via createSchemaBuilder().log(). After adding the new column/index, schemaInSync comes back false, meaning TypeORM's schema sync detects some difference between our hand-written migration SQL and what the @DeleteDateColumn()/@Index() decorators expect — I wasn't able to pin down the exact mismatch before running out of time on this PR. Flagging this explicitly rather than leaving it silently broken — happy to dig in further if pointed at the specific diff.

Testing performed

  • npm run build: clean, no errors.
  • npm test: 560/561 tests pass; the 1 failure is the schemaInSync issue described above.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Ummi-001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@phertyameen

Copy link
Copy Markdown
Contributor

@Ummi-001 can you fix CI please

1 similar comment
@phertyameen

Copy link
Copy Markdown
Contributor

@Ummi-001 can you fix CI please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants