- Restore blue PageHeader on Dashboard (/app-components) - Update homepage (/) with subtle header design without blue bar - Add uniform PageHeader styling to application edit page - Fix Rapporten link on homepage to point to /reports overview - Improve header descriptions spacing for better readability
5.1 KiB
Database Tables Audit
Date: 2026-01-09
Purpose: Verify all database tables are actually being used and clean up unused ones.
Summary
✅ All active tables are in use
❌ Removed: cached_objects (legacy, replaced by normalized schema)
Table Usage Status
✅ Active Tables (Normalized Schema)
These tables are part of the current normalized schema and are actively used:
-
schemas- ✅ USED- Stores Jira Assets schema metadata
- Used by:
SchemaRepository,schemaDiscoveryService,schemaConfigurationService
-
object_types- ✅ USED- Stores discovered object types from Jira schema
- Used by:
SchemaRepository,schemaDiscoveryService,schemaCacheService,schemaConfigurationService
-
attributes- ✅ USED- Stores discovered attributes per object type
- Used by:
SchemaRepository,schemaDiscoveryService,schemaCacheService,queryBuilder
-
objects- ✅ USED- Stores minimal object metadata
- Used by:
normalizedCacheStore,ObjectCacheRepository,QueryService,dataIntegrityService
-
attribute_values- ✅ USED- EAV pattern for storing all attribute values
- Used by:
normalizedCacheStore,ObjectCacheRepository,QueryService,queryBuilder,dataIntegrityService
-
object_relations- ✅ USED- Stores relationships between objects
- Used by:
normalizedCacheStore,ObjectCacheRepository,QueryService,dataIntegrityService,DebugController
-
sync_metadata- ✅ USED- Tracks sync state
- Used by:
normalizedCacheStore,cacheStore.old.ts(legacy)
-
schema_mappings- ⚠️ DEPRECATED but still in use- Maps object types to schema IDs
- Status: Marked as DEPRECATED in schema comments, but still actively used by
schemaMappingService - Note: According to refactor plan, this should be removed after consolidation
- Used by:
schemaMappingService,jiraAssetsClient,jiraAssets,dataValidationroutes
✅ Active Tables (Classification Database)
-
classification_history- ✅ USED- Stores AI classification history
- Used by:
databaseService,classificationsroutes,dashboardroutes
-
session_state- ✅ USED- Stores session state for classification workflow
- Used by:
databaseService
✅ Active Tables (Authentication & Authorization)
-
users- ✅ USED- User accounts
- Used by:
userService,authService,authroutes
-
roles- ✅ USED- Role definitions
- Used by:
roleService,rolesroutes
-
permissions- ✅ USED- Permission definitions
- Used by:
roleService,rolesroutes
-
role_permissions- ✅ USED- Junction table: roles ↔ permissions
- Used by:
roleService
-
user_roles- ✅ USED- Junction table: users ↔ roles
- Used by:
roleService,userService
-
user_settings- ✅ USED- Per-user settings (PAT, AI keys, etc.)
- Used by:
userSettingsService
-
sessions- ✅ USED- User sessions (OAuth and local auth)
- Used by:
authService
-
email_tokens- ✅ USED- Email verification and password reset tokens
- Used by:
userService
❌ Removed Tables
cached_objects - REMOVED (Legacy)
Status: ❌ Removed from schema generation
Reason: Replaced by normalized schema (objects + attribute_values tables)
Previous Usage:
- Only used by deprecated
cacheStore.old.ts - Old schema stored all object data as JSON in a single table
- New normalized schema uses EAV pattern for better querying and flexibility
Cleanup Actions:
- ✅ Removed from
generate-schema.tsscript - ✅ Removed from
backend/src/generated/db-schema.sql - ✅ Removed from
backend/src/generated/db-schema-postgres.sql - ✅ Added comment in migration script explaining it's only for legacy data migration
Migration Note:
- Migration script (
migrate-sqlite-to-postgres.ts) still referencescached_objectsfor migrating old data - This is intentional - needed for one-time migration from old schema to new schema
Notes
Schema Mappings Table
The schema_mappings table is marked as DEPRECATED in the schema comments but is still actively used. According to the refactor plan (docs/REFACTOR-PHASE-2B-3-STATUS.md), this table should be removed after consolidation of schema services. For now, it remains in use and should not be deleted.
Legacy Files
The following files still reference old schema but are deprecated:
backend/src/services/cacheStore.old.ts- Old cache store implementationbackend/src/generated/db-schema.sql- Legacy schema (now cleaned up)backend/src/generated/db-schema-postgres.sql- Legacy schema (now cleaned up)
Conclusion
✅ All 18 active tables are in use
✅ 1 unused table (cached_objects) has been removed from schema generation
⚠️ 1 table (schema_mappings) is marked deprecated but still in use - keep for now
The database schema is now clean with only actively used tables defined in the schema generation scripts.