When changing identifier systems (e.g., from using `getInternalId()` to `getSequence()`), implement comprehensive migration strategies to preserve data integrity and backward compatibility. For each change:
When changing identifier systems (e.g., from using getInternalId()
to getSequence()
), implement comprehensive migration strategies to preserve data integrity and backward compatibility. For each change:
// Example migration for collection renaming:
public function migrateCollections(): void
{
$buckets = $this->dbForProject->find('buckets');
foreach ($buckets as $bucket) {
$oldName = 'bucket_' . $bucket->getInternalId();
$newName = 'bucket_' . $bucket->getSequence();
if ($this->dbForProject->hasCollection($oldName) && !$this->dbForProject->hasCollection($newName)) {
// Rename collection to preserve existing data
$this->dbForProject->renameCollection($oldName, $newName);
Console::success("Migrated collection {$oldName} โ {$newName}");
}
}
}
Without proper migration planning, changes to identifier systems often result in orphaned data, broken queries, and critical production issues.
Enter the URL of a public GitHub repository