feat: convert DatabaseType from enum to string-based struct#304
feat: convert DatabaseType from enum to string-based struct#304
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (19)
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
5d00c5d to
2332b31
Compare
…ypeId alias tests
Summary
DatabaseTypefrom a closed 11-case enum to aHashable/Codable/Sendablestring-based struct, enabling future plugins to register new database types without modifying the appallKnownTypesarray (withallCasescompatibility shim),init?(validating:)failable initializer, andavailableDatabaseTypesonPluginManagerChanges
Core conversion (DatabaseConnection.swift):
struct DatabaseTypewithlet rawValue: String, static constants for all 11 built-in typesCodable(bare string encoding),Hashable,SendableconformancepluginTypeId,iconName,defaultPort,requiresAuthentication,supportsForeignKeys,supportsSchemaEditing,isDownloadablePlugin) use dictionary/set lookups with defaults for unknown typesSwitch statements (~15 files):
switchonDatabaseTypeto if/else chains or dictionary lookups withdefault:fallbacksCall site updates (3 files):
ConnectionFormView:allCases→allKnownTypesDeeplinkHandler:DatabaseType(rawValue:)→DatabaseType(validating:)+allKnownTypesConnectionStorage: removed?? .mysqlfallback (init is now non-failable)Infrastructure:
PluginManager.availableDatabaseTypescomputed property (ready for Phase 4.2)Theme.defaultDatabaseColorfor unknown type fallbackTests (3 files):
Test plan
xcodebuild build)DatabaseType.allCasesreferences remain in app codeCaseIterableconformance onDatabaseType