refactor(v5): remove Project model and consolidate v5 migrations

Drop v5_projects table, Project model, and related alter-table
migrations; fold cluster_id and nullable private_key_id into the
initial v5_servers migration; rename migration files to v5_ prefix;
strip cooldServers/privateKeys/teams props from HomeController and
Home page.
This commit is contained in:
Andras Bacsai
2026-06-16 16:57:52 +02:00
parent 5c23b9aaa5
commit 9566b259b2
10 changed files with 35 additions and 498 deletions
@@ -20,33 +20,11 @@ class HomeController extends Controller
{
public function __invoke(Request $request, FluxHealth $fluxHealth): Response
{
/** @var User $user */
$user = $request->user();
$currentTeam = $request->attributes->get('v5.currentTeam');
return Inertia::render('Home', [
'flux' => $fluxHealth->check(),
'clusters' => $this->clusters($currentTeam),
'cooldServers' => $this->cooldServers($currentTeam),
'privateKeys' => $this->privateKeys($currentTeam),
'currentTeam' => $currentTeam instanceof Team ? [
'id' => $currentTeam->id,
'name' => $currentTeam->name,
'description' => $currentTeam->description,
'role' => $currentTeam->pivot?->role ?? $user->roleInTeam($currentTeam->id),
'personal' => $currentTeam->personal_team,
] : null,
'teams' => $user->teams()
->select('teams.id', 'teams.name', 'teams.description', 'teams.personal_team')
->orderBy('teams.name')
->get()
->map(fn (Team $team) => [
'id' => $team->id,
'name' => $team->name,
'description' => $team->description,
'role' => $team->pivot->role,
'personal' => $team->personal_team,
]),
]);
}
@@ -124,27 +102,6 @@ class HomeController extends Controller
]);
}
/**
* @return array<int, array{uuid: string, name: string}>
*/
private function privateKeys(mixed $currentTeam): array
{
if (! $currentTeam instanceof Team) {
return [];
}
return PrivateKey::query()
->where('team_id', $currentTeam->id)
->select('uuid', 'name')
->orderBy('name')
->get()
->map(fn (PrivateKey $privateKey) => [
'uuid' => $privateKey->uuid,
'name' => $privateKey->name,
])
->all();
}
/**
* @return array<int, array{id: string, name: string, description: string|null, serversCount: int, servers: array<int, array{id: string, name: string, host: string, status: string, capabilities: array<int, string>}>}>
*/
@@ -175,31 +132,4 @@ class HomeController extends Controller
])
->all();
}
/**
* @return array<int, array{id: string, host: string, sshUser: string, sshPort: int, status: string, capabilities: array<int, string>, builderEnabled: bool, builderCapacity: int, lastBootstrappedAt: string|null}>
*/
private function cooldServers(mixed $currentTeam): array
{
if (! $currentTeam instanceof Team) {
return [];
}
return V5Server::query()
->where('team_id', $currentTeam->id)
->orderBy('name')
->get()
->map(fn (V5Server $server) => [
'id' => (string) $server->id,
'host' => $server->host,
'sshUser' => $server->ssh_user,
'sshPort' => $server->ssh_port,
'status' => $server->status,
'capabilities' => $server->capabilities ?? [],
'builderEnabled' => $server->builder_enabled,
'builderCapacity' => $server->builder_capacity,
'lastBootstrappedAt' => $server->last_bootstrapped_at?->toISOString(),
])
->all();
}
}