V1 Table Cleanup Phase 8 — Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Drop 16 dead v1 tables, the v1_backup schema, and all associated dead code from the Eko codebase.
Architecture: Single SQL migration drops all tables in FK-safe order, then TypeScript code cleanup removes schema definitions, query functions, type references, and re-exports atomically. The feature-flags.ts admin queries that reference already-dropped v1 tables are also gutted.
Tech Stack: Supabase Postgres (migration), Drizzle ORM (schema), TypeScript (queries/types), Bun (tooling)
Task 1: Create the SQL Migration
Files:
- Create:
supabase/migrations/0118_drop_v1_tables_phase8.sql
Step 1: Write the migration file
Create the migration following the exact pattern from migration 0111. Use DROP TABLE IF EXISTS ... CASCADE in FK-safe order (children before parents). Include:
-- ============================================================================
-- MIGRATION 0118: Drop V1 Tables — Phase 8
--
-- Removes 16 v1 tables that have no active v2 code paths, plus the v1_backup
-- schema created in Phase 6. Completes the v1 → v2 migration.
--
-- Tables dropped:
-- Page tracking: pages, page_observations, page_change_events,
-- page_change_summaries, user_pages, section_dom_mappings,
-- page_title_history, screenshot_captures
-- Notifications: sms_notification_pages, sms_delivery_log,
-- notification_delivery_log
-- User features: personas, use_cases, onboarding_state
-- Other: screen_avatars, type_metadata
--
-- Also drops:
-- - v1_backup schema (Phase 6 safety backups, now 14+ days old)
-- - Orphaned enums: avatar_source, use_case_audience, onboarding_step
-- - Orphaned functions: get_sms_page_count, can_add_sms_page
-- ============================================================================
-- ============================================================================
-- 1. Drop tables in FK-safe order (children → parents)
-- ============================================================================
-- Page tracking children (depend on pages, page_observations, page_change_events)
DROP TABLE IF EXISTS section_dom_mappings CASCADE;
DROP TABLE IF EXISTS page_title_history CASCADE;
DROP TABLE IF EXISTS screenshot_captures CASCADE;
DROP TABLE IF EXISTS page_change_summaries CASCADE;
-- Notification tables (depend on page_change_events and profiles)
DROP TABLE IF EXISTS sms_delivery_log CASCADE;
DROP TABLE IF EXISTS notification_delivery_log CASCADE;
DROP TABLE IF EXISTS sms_notification_pages CASCADE;
-- Page tracking parents
DROP TABLE IF EXISTS page_change_events CASCADE;
DROP TABLE IF EXISTS page_observations CASCADE;
DROP TABLE IF EXISTS user_pages CASCADE;
DROP TABLE IF EXISTS pages CASCADE;
-- User features
DROP TABLE IF EXISTS use_cases CASCADE;
DROP TABLE IF EXISTS personas CASCADE;
DROP TABLE IF EXISTS onboarding_state CASCADE;
-- Other
DROP TABLE IF EXISTS screen_avatars CASCADE;
DROP TABLE IF EXISTS type_metadata CASCADE;
-- ============================================================================
-- 2. Drop v1_backup schema (Phase 6 safety backups)
-- ============================================================================
DROP SCHEMA IF EXISTS v1_backup CASCADE;
-- ============================================================================
-- 3. Drop orphaned enums (only used by dropped tables)
-- ============================================================================
DROP TYPE IF EXISTS avatar_source CASCADE;
DROP TYPE IF EXISTS use_case_audience CASCADE;
DROP TYPE IF EXISTS onboarding_step CASCADE;
-- ============================================================================
-- 4. Drop orphaned functions (only used by dropped tables)
-- ============================================================================
DROP FUNCTION IF EXISTS get_sms_page_count(UUID) CASCADE;
DROP FUNCTION IF EXISTS can_add_sms_page(UUID) CASCADE;
Step 2: Verify migration file is valid SQL
Run: bun run migrations:index
Expected: Index regenerates successfully with 0118 included.
Step 3: Commit
git add supabase/migrations/0118_drop_v1_tables_phase8.sql
git commit -m "feat(db): add Phase 8 migration to drop 16 v1 tables and v1_backup schema"
Task 2: Remove Drizzle Schema Definitions
Files:
- Modify:
packages/db/src/drizzle/schema.ts
Step 1: Remove table definitions and relations
Remove the following table definitions and their associated relations objects from schema.ts:
Tables to remove (including their Relations exports):
pages+pagesRelations(line ~728)pageObservations+pageObservationsRelations(line ~770)pageChangeEvents+pageChangeEventsRelations(line ~794)pageChangeSummaries+pageChangeSummariesRelations(line ~815)userPages+userPagesRelations(line ~847)screenshotCaptures(line ~942) + any relationssectionDomMappings+sectionDomMappingsRelations(line ~996)pageTitleHistory+pageTitleHistoryRelations(line ~1084)smsNotificationPages+smsNotificationPagesRelations(line ~373) + thesmsNotificationUrlsalias (line 387)smsDeliveryLog+smsDeliveryLogRelations(line ~393)notificationDeliveryLog+notificationDeliveryLogRelations(line ~440)personas+personasRelations(line ~1177)useCases(line ~1196)onboardingState(line ~1251)screenAvatars(line ~248)typeMetadata(line ~1147)
Also remove:
- The
InlineDiffinterface (line ~278) — used only by page change summaries - The
V1 TABLES REMOVED - Phase 6 Cleanupcomment block (lines ~262-273) — replace with a shorter note - The
smsNotificationUrlsdeprecated alias - Any enum definitions used only by dropped tables:
onboardingStepEnum,metadataCategoryEnum(if only used by typeMetadata),avatarSourceEnum(if defined),useCaseAudienceEnum(if defined),notificationChannelEnum,notificationDeliveryStatusEnum - The
url_renders table REMOVEDandvideo_renders table REMOVEDcomments (lines ~286-288)
Keep intact:
profiles,domains,brands,brandCategories,brandCategoryAssignments,planDefinitions,userSubscriptions,notificationPreferences,systemNotifications- All fact engine tables
featureFlags,aiModelTierConfig,aiCostTracking- Relations for kept tables (update if they reference dropped tables)
Important: Check any relations on KEPT tables that reference DROPPED tables. For example:
profilesRelationsmay haveuserPages,smsNotificationPages,notificationDeliveryLog,onboardingState— remove those relation entriesdomainsRelationsmay referencescreenAvatars— remove thatbrandsRelationsorbrandCategoriesRelationsmay not need changes ifbrandCategoryAssignmentsis kept
Step 2: Verify TypeScript compiles
Run: bun run typecheck
Expected: May fail due to import references in other files — that's expected and fixed in subsequent tasks.
Step 3: Commit
git add packages/db/src/drizzle/schema.ts
git commit -m "refactor(db): remove 16 v1 table definitions from Drizzle schema"
Task 3: Remove Dead Query Functions from drizzle/queries.ts
Files:
- Modify:
packages/db/src/drizzle/queries.ts
Step 1: Remove page tracking query functions
Remove all functions that operate on dropped tables. These include:
Page tracking (pages, pageObservations, pageChangeEvents, pageChangeSummaries, userPages):
listBrandUrls,updateUrlPageType,listUrlsByPageType,listUrlsWithoutPageTypeattachUrlToUserLibrary,getUserLibrary,getUserActiveLibrary,getUserLibraryByBrandgetTrackedUrlsForDomainVNext,updateUserLibraryEntry,removeFromUserLibrarycountActiveLibraryUrls,getUserLibraryEntrycreateUrlObservation,getObservationsForUrl,getLatestObservationcreateUrlChangeEvent,getChangeEventsForUrl,getChangeEventsForUrlGatedgetChangeEventById,getChangeEventByIdV1CompatcreateUrlChangeSummary,getSummaryForChangeEventlistDashboardLatestUpdatesgetDueUrlsVNext,getDueUrlsWithLatestObservation,hasDueUrlsNotCheckedTodaygetLatestObservationForUrl,hasCheckedTodayVNext,getTrackedUrlsVNextgetRecentChangesVNext,getRecentChangesWithSummariesVNext,getUrlStatsVNextupdateNextCheckTimeVNextgetUrlByCanonicalUrl,updateUrlPageDescription,updateUrlEkoNotegetOrCreateGlobalUrlFull,subscribeUserToUrl,getUrlWithUserSubscriptiongetEffectiveNoteForUrl,shouldUpdatePageDescription
Screenshot captures:
createScreenshotCapture,getScreenshotsForChange,getScreenshotsWithPairsgetPrimaryScreenshot,getLatestScreenshotForUrl,linkScreenshotPairupdateScreenshotDiff,hasRecentBaselineScreenshot,getPrimaryScreenshotForCheckmarkScreenshotAsBefore,updateScreenshotDiffData
Section DOM mappings:
createSectionDomMapping,getDomMappingsForCheck,getDomMappingForSectionbatchCreateSectionDomMappings,upsertSectionDomMapping,upsertSectionDomMappingVNext
Page title history:
recordPageTitleChange,getPageTitleHistory,getPageTitleChangeCountgetFirstRecordedTitle,hasTitleChanged
SMS notifications:
getSmsUrlCount,getSmsLimitForUser,canAddSmsUrlgetSmsNotificationUrlsForUser,isSmsEnabledForUrl,enableSmsForUrldisableSmsForUrl,updateSmsPreferences,setSmsVerificationCodeverifySmsCode,getUsersForSmsNotification,logSmsDeliveryupdateSmsDeliveryStatus,getRecentSmsDeliveries,isWithinSmsQuietHoursgetPendingSmsDelivery,getNotificationPreferencesByUserIdgetSmsDeliveryByProviderId,updateSmsDeliveryByProviderId
Notification delivery log:
getPendingDigestNotificationsVNext,batchCreateNotificationDeliveriesVNextbatchMarkNotificationsSentVNext
Screen avatars:
getScreenAvatarForDomain,getScreenAvatarForUrl,getScreenAvatarsBatchadminListScreenAvatars,adminCountScreenAvatarsBySourceupsertScreenAvatar,revertScreenAvatarToOriginal,deleteScreenAvatargetScreenAvatarWithDomain,searchScreenAvatars
Audience/personas:
getAudienceOverview,getDomainsForAudienceAdmin,getPageTypesForAudienceAdmingetPersonasForAudienceAdmin,getUseCasesForAudienceAdminupdateDomainAudience,updatePageTypeAudience,updatePersonaAudienceupdateUseCaseAudience
Other dead functions:
hasAnyPremiumUserTrackingPage— referencesuserUrlLibraryandpagescreateDeepAnalysisSummary— if it depends on dropped tablesfindRecentDomainChanges— if it queries page_change_events
Also remove:
SMS_LIMITS_BY_PLANconstantResolvedAvatartype- Any helper types only used by removed functions
- Import statements for removed schema tables
Keep intact:
getUserSubscriptionWithPlan,getUserEffectivePlan,getOrCreateDomaingetNotificationPreferences,getFreePlan,getAllActivePlans,getDomainByIdgetOrCreateGlobalUrl,getGlobalUrlById,getGlobalUrlByCanonical- Brand query functions:
linkDomainToBrand,findBrandForDomain,getDomainWithBrand, etc. - Brand category functions:
getBrandCategories,getBrandPrimaryCategory, etc. - AI cost tracking:
recordAICost,getDailyCostBreakdown, etc. - Domain verification functions
createDomainRejectionNotifications(uses systemNotifications which is kept)getDomainComplexityCache,updateDomainComplexityCache
Step 2: Commit
git add packages/db/src/drizzle/queries.ts
git commit -m "refactor(db): remove dead v1 query functions from drizzle/queries.ts"
Task 4: Gut feature-flags.ts Admin Queries
Files:
- Modify:
packages/db/src/drizzle/feature-flags.ts
Step 1: Remove admin functions that reference dropped v1 tables
These functions use raw SQL that references tracked_urls, url_checks, url_changes, and summaries — tables that were dropped in Phase 6. They've been dead code since then. Remove:
getInlineDiffStats(referencessection_content_snapshots,url_changes)adminSearchUrls(referencestracked_urls)adminListRecentUrls(referencestracked_urls,url_checks,url_changes)adminGetUrlDetails(referencestracked_urls,url_checks,url_changes,summaries)adminListRecentChanges(referencesurl_changes,tracked_urls,summaries)adminGetUrlForRequeue(referencestracked_urls)adminListUsers(referencestracked_urls)adminSearchUsers(referencestracked_urls)adminGetUserDetails(referencestracked_urls)adminGetUserNotificationPreferences— check if it uses dropped tables or notification_preferences (kept)adminGetUserNotificationHistory(referencesnotification_deliveries,url_changes,tracked_urls,summaries)adminGetUserSystemNotifications— check if it uses system_notifications (kept)adminGetUserRecentChanges(referencesurl_changes,tracked_urls,summaries)adminGetUserUrlStats(referencestracked_urls,url_checks,url_changes)adminGetUserTrackedUrls(referencestracked_urls)adminGetSummaryByChangeId(referencessummaries,url_changes,tracked_urls)adminUpdateSummaryOverride(referencessummaries)adminGetOnboardingStats(referencesonboarding_state)adminListOnboardingStates(referencesonboarding_state)adminGetStuckUsers(referencesonboarding_state)adminResetUserOnboarding(referencesonboarding_state)adminGetUserOnboardingState(referencesonboarding_state)adminGetContentStats(referencesapp_content— already dropped)adminListContent(referencesapp_content)adminGetContentByKey(referencesapp_content)adminGetContentById(referencesapp_content)adminUpdateContent(referencesapp_content)adminResetContent(referencesapp_content)adminUpsertContent(referencesapp_content)adminBulkUpsertContent(referencesapp_content)getContentValue(referencesapp_content)getContentValues(referencesapp_content)
Keep intact:
getFeatureFlag,isFeatureEnabled,isFeatureEnabledSafeisAIProviderEnabled,getFeatureFlagConfig,getInlineDiffsConfiggetAIModelTierConfig,listFeatureFlags,updateFeatureFlag,upsertFeatureFlag
Step 2: Commit
git add packages/db/src/drizzle/feature-flags.ts
git commit -m "refactor(db): remove dead admin queries from feature-flags.ts"
Task 5: Remove Dead Functions from queries.ts (Supabase Client)
Files:
- Modify:
packages/db/src/queries.ts
Step 1: Remove v1 Supabase-client query functions
Remove all functions that operate on dropped v1 tables (tracked_urls, url_checks, url_changes, summaries, pages, user_pages, etc.). This file has extensive v1 functions. Remove:
Tracked URL functions:
countActiveTrackedUrls,getTrackedUrlsByUser,getTrackedUrlByIdcreateTrackedUrl,updateTrackedUrl,deleteTrackedUrlgetDueUrls,updateNextCheckTimegetTrackedUrlsForDomain(deprecated stub),getTrackedUrlsWithDomain(deprecated stub)
URL check functions:
getLatestCheck,getChecksForUrl,hasCheckedToday,createUrlCheckbatchCreateUrlChecks
URL change functions:
getChangesForUrl,createUrlChange
Summary functions:
getSummaryForChange,createSummary
URL render functions:
createUrlRender,getRendersForUrl,getLatestRenderForUrl
Notification delivery functions (v1 versions):
createNotificationDelivery,updateNotificationDeliveryStatusbatchCreateNotificationDeliveries,batchMarkNotificationsSentgetPendingDigestNotifications
User library / URL management:
getOrCreateGlobalUrlByCanonical,getGlobalUrlById,listBrandUrlsattachUrlToUserLibrary,getUserLibrary,updateUserLibraryEntryremoveFromUserLibrary,countActiveLibraryUrlslistUrlUpdateInstances,getUpdateInstanceDetail,listDashboardLatestUpdatescreateUrlObservation,createUrlChangeEvent,createUrlChangeSummaryupdateUrlPageType,listUrlsByPageType,listUrlsWithoutPageTypeupdateTrackedUrlEkoNote
Folder functions (all — tables already dropped):
- All
getUserFolders,getFolderById,createFolder,updateFolder,deleteFolder - All
getFolderUrls,addUrlToFolder,removeUrlFromFolder, etc. - All
getUserFavoriteFolders,createFavoriteFolder, etc. - All
markUrlAsRead,markFolderUrlsAsRead,getFolderUnreadCounts getUserSavedItems,getSavedItemCounts,saveItem,unsaveItem, etc.
Page/brand type metadata:
getAllPageTypeMetadata,getPageTypeMetadata,getFeaturedUrlsForPageType(deprecated)getUserUrlCountsByPageType(deprecated),getUrlsForPageType(deprecated)getAllBrandTypeMetadata,getBrandTypeMetadata,getFeaturedDomainsForType(deprecated)getUserUrlCountsByBrandType(deprecated),getDomainsForType(deprecated)
Persona/onboarding:
getAllPersonas,getPersonaBySlug,getFeaturedUseCasesForPersonagetUseCasesForPersona,getUseCaseByIdgetOnboardingState,createOnboardingState,getOrCreateOnboardingStateupdateOnboardingStep,completeOnboarding,skipOnboarding,hasCompletedOnboarding
Usage stats (references tracked_urls/url_changes):
getMonthlyUsageStats— referencestracked_urlsandurl_changesgetUserTotalChangesCount— referencesurl_changes- Milestone functions:
getUrlMilestone,getChangeMilestone— keep if pure logic, remove if they query dropped tables hasMilestoneNotification— check if it uses system_notifications (kept) or dropped tables
Also remove:
- All type definitions only used by removed functions (
TrackedUrl,UrlCheck,UrlChange,Summary,UserFolder,FolderUrlEntry,FolderUsage,OnboardingStateRow,PersonaRow,UseCaseRow,PageTypeMetadataRow,BrandTypeMetadataRow,SavedItemCounts, etc.) - Dead interfaces
- Dead enum re-exports
Keep intact:
getUserSubscriptionWithPlan,getFreePlan,getUserEffectivePlan,getUserPlanWithUrlCountgetOrCreateDomain,getDomainById,listUserDomains(if used)getNotificationPreferences,upsertNotificationPreferencesgetProfileDetails,upsertProfileDetails- All billing/subscription functions:
getUserInvoices,getBillingCustomer,getAllPlans, etc. createSystemNotification,hasBillingNotificationForPeriod,hasEscalationAtLevelgetUnreadNotificationCount,getUserSystemNotifications,markNotificationRead, etc.getUserEmailById,getUserBillingPeriodStartgetAllActiveUsersWithEmail,hasMonthlyReportForPeriodgetUserAccountCreatedAt,getUsersWithAnniversaryMilestonesisWithinQuietHours— pure logic function, keep if used by kept notification code
Step 2: Also clean up the client.ts type definitions
Remove type definition blocks in packages/db/src/client.ts for tables that no longer exist:
url_checksRow/Insert/Update/Relationships (~lines 360-406)url_changesRow/Insert/Update/Relationships (~lines 408-451)summariesRow/Insert/Update/Relationships (~lines 453-498)url_rendersRow/Insert/Update/Relationships (~lines 500-550)notification_deliveriesif still present
Note: client.ts appears to be a manually maintained type file (not auto-generated). Remove the dead table type blocks.
Step 3: Commit
git add packages/db/src/queries.ts packages/db/src/client.ts
git commit -m "refactor(db): remove dead v1 query functions from queries.ts and client.ts"
Task 6: Clean Up Exports and Imports
Files:
- Modify:
packages/db/src/index.ts - Modify: Any app files that import removed symbols
Step 1: Clean up index.ts re-exports
Remove all re-exports of deleted symbols from packages/db/src/index.ts. Based on the current file:
From the drizzle/queries export block (lines 74-147), remove:
batchCreateSectionDomMappings,canAddSmsUrl,createScreenshotCapturecreateSectionDomMapping,disableSmsForUrl,enableSmsForUrlgetAudienceOverview,getBrandsForAudienceAdmingetChangeEventById,getChangeEventsForUrlGatedgetDomMappingForSection,getDomMappingsForCheckgetFirstRecordedTitle,getLatestScreenshotForUrlgetNotificationPreferencesByUserId,getPageTitleChangeCountgetPageTitleHistory,getPageTypesForAudienceAdmingetPendingSmsDelivery,getPersonasForAudienceAdmingetPrimaryScreenshot,getPrimaryScreenshotForCheckgetRecentSmsDeliveries,getScreenAvatarForBrandgetScreenAvatarForDomain,getScreenshotsForChangegetScreenshotsWithPairs,getSmsDeliveryByProviderIdgetSmsLimitForUser,getSmsNotificationUrlsForUsergetSmsUrlCount,getUseCasesForAudienceAdmingetUsersForSmsNotification,hasRecentBaselineScreenshothasTitleChanged,isSmsEnabledForUrl,isWithinSmsQuietHourslinkScreenshotPair,logSmsDelivery,markScreenshotAsBeforerecordPageTitleChange,SMS_LIMITS_BY_PLANsetSmsVerificationCode,updateBrandAudienceupdateDomainAudience,updatePageTypeAudienceupdatePersonaAudience,updateScreenshotDiffupdateScreenshotDiffData,updateSmsDeliveryByProviderIdupdateSmsDeliveryStatus,updateSmsPreferencesupdateUseCaseAudience,upsertSectionDomMappingupsertSectionDomMappingVNext,verifySmsCode- Type exports:
AudienceDistribution,AudienceOverview,CostBreakdownRow,RecordAICostParams— keepCostBreakdownRowandRecordAICostParamsif still used
From the drizzle/schema export block (lines 148-179), remove:
metadataCategoryEnum,notificationChannelEnumnotificationDeliveryLog,notificationDeliveryStatusEnumonboardingState,onboardingStepEnumpageTitleHistory,personasscreenshotCaptures,sectionDomMappingssmsDeliveryLog,smsNotificationPages,smsNotificationUrlssystemNotificationTypeEnum— keep ifsystemNotificationsuses it (it's kept)typeMetadata,useCasesSystemNotificationMetadatatype,TypeMetadataExtratype
Also remove or update:
export * as feederSourceQueries from './queries.feeder-sources'— keep if feeder_sources table is still activeexport * from './queries'— keep but dead exports will be naturally removed since the functions are gone
Step 2: Find and fix broken imports in apps/
Search for any imports of removed symbols across the monorepo:
grep -r "from '@eko/db'" apps/ --include="*.ts" --include="*.tsx"
Key files to check:
apps/web/app/api/account/notifications/route.ts— importsgetNotificationPreferences(kept) andupsertNotificationPreferences(kept) — should be fine- Any files importing SMS, screenshot, section DOM mapping, persona, onboarding, or page tracking symbols — these imports must be removed along with the code that uses them
Step 3: Commit
git add packages/db/src/index.ts
git add -u apps/ # stage any app changes
git commit -m "refactor(db): clean up exports and fix broken imports"
Task 7: Remove Dead Test Files
Files:
- Modify:
packages/db/src/__tests__/security/test-helpers.ts - Modify:
packages/db/src/__tests__/security/tenant-isolation.test.ts - Modify:
packages/db/src/__tests__/security/api-route-isolation.test.ts - Possibly delete entire test files if they only test dropped tables
Step 1: Clean up test helpers
In test-helpers.ts, remove helper functions and types that create/reference v1 tables:
createTrackedUrl,createUrlCheck,createUrlChange,createSummary,createNotificationDeliveryhelpers (if present)- All type definitions for dropped tables
Step 2: Clean up or remove test files
In tenant-isolation.test.ts, remove test cases for:
- "User B CANNOT read url_checks via tracked_url_id"
- "User B CANNOT read url_changes via tracked_url_id"
- "User B CANNOT read summaries via url_change_id"
- Any other tests for dropped tables
In api-route-isolation.test.ts, remove assertions referencing tracked_url_id.
If entire test files become empty after cleanup, delete them.
Step 3: Run tests
Run: bun run test
Expected: All remaining tests pass.
Step 4: Commit
git add packages/db/src/__tests__/
git commit -m "test(db): remove v1 table test helpers and isolation tests"
Task 8: Regenerate Types and Indexes
Step 1: Regenerate migrations index
Run: bun run migrations:index
Expected: Index regenerates with migration 0118 included.
Step 2: Verify everything compiles
Run: bun run typecheck
Expected: Zero errors.
Step 3: Run full test suite
Run: bun run test
Expected: All tests pass.
Step 4: Run lint
Run: bun run lint
Expected: No new errors.
Step 5: Commit generated files
git add supabase/migrations-index.md
git commit -m "chore(db): regenerate migrations index for Phase 8"
Task 9: Update Changelog and Final Verification
Files:
- Modify:
docs/changelog/unreleased.md
Step 1: Add changelog entry
Add to today's date section under "Features" (or "Refactoring"):
## February 17, 2026
### Refactoring
- **Database**: Drop 16 v1 legacy tables (page tracking, SMS notifications, personas, onboarding, screen avatars, type metadata) and v1_backup schema — Phase 8 cleanup
- **Database**: Remove ~3000 lines of dead v1 query functions, type definitions, and test helpers
Step 2: Run full CI check
Run: bun run ci
Expected: All checks pass.
Step 3: Commit
git add docs/changelog/unreleased.md
git commit -m "docs: add Phase 8 v1 cleanup to changelog"
Summary
| Task | Files | Effort |
|---|---|---|
| 1. SQL migration | 1 new file | Small |
| 2. Drizzle schema cleanup | schema.ts | Medium |
| 3. drizzle/queries.ts cleanup | queries.ts | Large (many functions) |
| 4. feature-flags.ts cleanup | feature-flags.ts | Medium |
| 5. queries.ts + client.ts cleanup | 2 files | Large (many functions) |
| 6. Export/import cleanup | index.ts + apps/ | Medium |
| 7. Test cleanup | tests/ | Small |
| 8. Regenerate + verify | generated files | Small |
| 9. Changelog + CI | changelog | Small |