Skip to content

Commit 23eb9e4

Browse files
NebuloDevCopilot
andcommitted
Populate record identifiers during migration
Backfill existing subdomains before enforcing the non-null effective record identifier and guard missing SRV service types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c307aa3 commit 23eb9e4

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎subdomains/database/migrations/011_allow_compatible_record_types.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function up(): void
1616
});
1717

1818
Subdomain::query()->with('server')->each(function (Subdomain $subdomain) {
19+
$subdomain->record_identifier = $subdomain->record_type->uniqueIdentifier($subdomain->server);
1920
$subdomain->saveQuietly();
2021
});
2122

‎subdomains/src/Enums/RecordType.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function uniqueIdentifier(Server $server): string
2626
return $this->value;
2727
}
2828

29-
return SRVServiceType::fromServer($server)->value ?? 'SRV';
29+
$serviceType = SRVServiceType::fromServer($server);
30+
31+
return $serviceType ? $serviceType->value : 'SRV';
3032
}
3133

3234
/**

0 commit comments

Comments
 (0)