Completely clears all primary key to shard mappings from both KV storage
and the Durable Object coordinator. This operation resets the entire
routing system to a clean state.
DANGER: This operation is destructive and irreversible. After flushing,
all existing primary keys will be treated as new and may be assigned to
different shards than before, causing data routing issues.
Use only for:
Development and testing environments
Complete system resets
Emergency recovery scenarios
Returns Promise<void>
Promise that resolves when all mappings are cleared
Example
// Only use in development! if (process.env.NODE_ENV === 'development') { awaitflush(); console.log('All shard mappings cleared for testing');
// Now all keys will be reassigned on next access awaitrun('user-123', 'INSERT INTO users (id, name) VALUES (?, ?)', ['user-123', 'Test User']); }
Flushes all shard mappings (development only)
Completely clears all primary key to shard mappings from both KV storage and the Durable Object coordinator. This operation resets the entire routing system to a clean state.
DANGER: This operation is destructive and irreversible. After flushing, all existing primary keys will be treated as new and may be assigned to different shards than before, causing data routing issues.
Use only for: