The D1 database instance to check and potentially migrate
The shard binding name for this database
CollegeDB configuration containing KV and strategy
Optional migration configuration
Optional
maxRecordsToCheck?: numberOptional
migrateOtherColumns?: booleanWhen true, creates additional lookup keys for username, email, and name columns
Optional
primaryKeyColumn?: stringOptional
skipCache?: booleanOptional
tablesToCheck?: string[]Promise resolving to migration result summary
Automatically detects if a database needs migration and performs it
This function is called automatically by CollegeDB operations to detect existing databases that contain data but haven't been integrated into the sharding system. It performs seamless migration without user intervention.
The detection process:
When
migrateOtherColumns
is enabled, additional lookup keys will be created for username, email, and name columns if they exist in the tables.