Performs a lightweight check to determine if a database contains existing data that hasn't been mapped to the sharding system. This is used internally to trigger automatic migration.
The D1 database instance to check
The shard binding name
CollegeDB configuration
Promise resolving to true if migration is needed
const needsMigration = await checkMigrationNeeded(env.DB, 'db-main', config);if (needsMigration) { console.log('Database contains unmapped data');} Copy
const needsMigration = await checkMigrationNeeded(env.DB, 'db-main', config);if (needsMigration) { console.log('Database contains unmapped data');}
Performs a lightweight check to determine if a database contains existing data that hasn't been mapped to the sharding system. This is used internally to trigger automatic migration.