chore(schema): remove the deprecated helperProfiles Drizzle stub — first real-positive in the roadmap dead-code list

Phase 2 of the IT-Hilfe migration (migration 061) unified
helper_profiles into repairer_profiles (profile_tier='community').
The Drizzle table definition + the HelperProfile / NewHelperProfile
types stuck around as a "deprecated stub kept so existing Drizzle
migrations compile." The justification didn't hold — Drizzle
migrations are SQL files that don't reference the TS schema. The
real reason was just inertia: nothing imported it, but removing it
needed verification that nothing would break.

Verification (matches the same pattern that turned up 6 wrong-framing
results earlier this thread):

  grep -rn "helperProfiles\|HelperProfile" src/ → 7 matches across
  3 places:
  - src/db/schema/itHilfe.ts: the schema + 2 types (the stub itself)
  - src/app/api/technicians/[id]/route.ts:5: a comment reference
  - src/db/schema/services.ts:197: a comment reference

No production code, no API routes, no tests import the symbol. The
4 test files that mention `helperProfiles` use it as a jest.mock
key (mocking the @/db/schema barrel) — they don't import the real
value, so removing the export doesn't break their mocks.

Removed: the pgTable declaration (lines 148-193), the 2 type
exports, and the old "kept so migrations compile" comment. Replaced
the header with a current-state explanation: the DB table +
helper_profiles_v view still exist for historical preservation,
but the TS-level surface is gone so no future code can accidentally
write to the deprecated table.

This is the FIRST roadmap "dead code" claim this thread that
turned out to be correct (vs the 6 prior false-positives:
intake_tier, finances alias, admin-actions, AI diagnosis,
activityFeed, staticPages). The distinguishing characteristic:
helperProfiles had an explicit in-file comment marking it
deprecated with a clear migration trail (061), whereas the prior
6 claims relied on Drizzle-symbol greps that missed raw-SQL access
and server-component queries.

7566 tests pass across 507 suites; tsc clean; lint 6/0 unchanged.

A future migration can drop the DB table + view once it's confirmed
no operational tooling reads them — that's a DB-level change out of
single-session scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-05-26 08:12:03 +02:00
1 parent 5acdae156b
commit 0b41010653
1 file changed
+13 -56
+13 -56
View File
@@ -136,61 +136,18 @@ export type UserSkill = typeof userSkills.$inferSelect
export type NewUserSkill = typeof userSkills.$inferInsert
// =============================================================================
// HELPER PROFILES — DEPRECATED, kept for Drizzle schema reference only
// HELPER PROFILES — TS-level REMOVED (was kept as a Drizzle-only deprecated stub)
// =============================================================================
// Phase 2 migration complete: IT_HILFE_TECHNICIAN_PROFILES now points to
// repairer_profiles (profile_tier='community'). This table definition is kept
// so existing Drizzle migrations compile; do NOT use helperProfiles in new queries.
// Safe to drop helper_profiles table once helper_profiles_v view is also dropped.
// Phase 2 migration unified helper_profiles into repairer_profiles
// (profile_tier='community'). The Drizzle table definition has been
// removed; no TypeScript code references it (verified by grep at
// removal time — only the schema file itself and two adjacent
// comments mentioned the name). The earlier comment claimed the
// definition was kept "so existing Drizzle migrations compile" but
// Drizzle migrations are SQL files that don't reference the TS
// schema, so that justification didn't hold.
//
// Optional profile for users who want to offer IT help services.
export const helperProfiles = pgTable('helper_profiles', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id').notNull().unique().references(() => users.id, { onDelete: 'cascade' }),
// Profile information
bio: text('bio'),
avatarUrl: text('avatar_url'),
// Pricing
hourlyRateCents: integer('hourly_rate_cents'),
acceptsGratis: boolean('accepts_gratis').default(true),
acceptsKulturlegi: boolean('accepts_kulturlegi').default(true),
// Service delivery options
serviceTypes: text('service_types').array().default(['remote', 'onsite']),
// Location for onsite services
locationPostalCode: varchar('location_postal_code', { length: 10 }),
locationCity: varchar('location_city', { length: 100 }),
locationCanton: varchar('location_canton', { length: 50 }),
maxTravelKm: integer('max_travel_km').default(10),
// Availability
isActive: boolean('is_active').default(true),
// Verification and moderation (added by 045)
isVerified: boolean('is_verified').default(false),
verifiedAt: timestamp('verified_at', { withTimezone: true, mode: 'string' }),
verifiedBy: uuid('verified_by').references(() => users.id),
suspendedAt: timestamp('suspended_at', { withTimezone: true, mode: 'string' }),
adminNotes: text('admin_notes'),
// Statistics
totalHelpsCompleted: integer('total_helps_completed').default(0),
averageRating: decimal('average_rating', { precision: 3, scale: 2 }),
// Timestamps
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' }).defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true, mode: 'string' }).defaultNow(),
}, (table) => [
index('idx_helper_profiles_user_id').on(table.userId),
index('idx_helper_profiles_location').on(table.locationPostalCode),
index('idx_helper_profiles_canton').on(table.locationCanton),
index('idx_helper_profiles_active').on(table.isActive),
index('idx_helper_profiles_rating').on(table.averageRating),
])
export type HelperProfile = typeof helperProfiles.$inferSelect
export type NewHelperProfile = typeof helperProfiles.$inferInsert
// The DB-level objects (helper_profiles table, helper_profiles_v
// view) still exist — keeping them preserves the historical rows
// for any post-hoc inspection or recovery. A future migration can
// drop both once it's confirmed no operational tooling reads them.