Phase4
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 9s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 12:32:27 +02:00
parent 9b061c3ee7
commit 4262464cd5
101 changed files with 4024 additions and 74 deletions

View File

@@ -37,6 +37,8 @@ enum GameServerStatus {
STARTING
RUNNING
STOPPING
BACKING_UP
RESTORING
ERROR
DELETING
DELETED
@@ -63,6 +65,37 @@ enum JobStatus {
CANCELLED
}
enum BackupStatus {
PENDING
RUNNING
AVAILABLE
FAILED
DELETED
}
enum BackupType {
MANUAL
SCHEDULED
PRE_RESTORE
PRE_WORLD_REPLACE
}
enum BackupRestoreStatus {
PENDING
RUNNING
COMPLETED
FAILED
}
enum WorldUploadStatus {
PENDING
UPLOADING
VALIDATING
READY
COMPLETED
FAILED
}
model User {
id String @id @default(uuid())
email String @unique
@@ -219,6 +252,7 @@ model GameServer {
containerId String?
dataPath String?
ramMb Int @default(1024)
activeWorldName String @default("world")
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime @updatedAt @db.Timestamptz(3)
@@ -227,6 +261,10 @@ model GameServer {
node GameNode? @relation(fields: [nodeId], references: [id])
stateTransitions GameServerStateTransition[]
allocation GameServerAllocation?
backups ServerBackup[]
backupRestores BackupRestore[]
backupSchedule BackupSchedule?
worldUploads WorldUpload[]
@@index([userId])
@@index([nodeId])
@@ -385,3 +423,82 @@ model JobRecord {
@@index([createdAt])
@@map("job_records")
}
model ServerBackup {
id String @id @default(uuid())
serverId String
type BackupType @default(MANUAL)
status BackupStatus @default(PENDING)
s3Key String?
sizeBytes BigInt?
sha256 String?
label String?
failureReason String?
createdAt DateTime @default(now()) @db.Timestamptz(3)
completedAt DateTime? @db.Timestamptz(3)
expiresAt DateTime? @db.Timestamptz(3)
server GameServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
restores BackupRestore[] @relation("RestoredFromBackup")
safetyForRestores BackupRestore[] @relation("SafetyBackup")
@@index([serverId])
@@index([status])
@@index([createdAt])
@@map("server_backups")
}
model BackupRestore {
id String @id @default(uuid())
serverId String
backupId String
safetyBackupId String?
status BackupRestoreStatus @default(PENDING)
failureReason String?
createdAt DateTime @default(now()) @db.Timestamptz(3)
completedAt DateTime? @db.Timestamptz(3)
server GameServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
backup ServerBackup @relation("RestoredFromBackup", fields: [backupId], references: [id])
safetyBackup ServerBackup? @relation("SafetyBackup", fields: [safetyBackupId], references: [id])
@@index([serverId])
@@index([backupId])
@@index([status])
@@map("backup_restores")
}
model BackupSchedule {
id String @id @default(uuid())
serverId String @unique
enabled Boolean @default(true)
intervalHours Int @default(24)
retentionCount Int @default(5)
nextRunAt DateTime? @db.Timestamptz(3)
lastRunAt DateTime? @db.Timestamptz(3)
createdAt DateTime @default(now()) @db.Timestamptz(3)
updatedAt DateTime @updatedAt @db.Timestamptz(3)
server GameServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
@@map("backup_schedules")
}
model WorldUpload {
id String @id @default(uuid())
serverId String
status WorldUploadStatus @default(PENDING)
s3Key String
worldName String @default("world")
sha256 String?
sizeBytes BigInt?
failureReason String?
createdAt DateTime @default(now()) @db.Timestamptz(3)
completedAt DateTime? @db.Timestamptz(3)
server GameServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
@@index([serverId])
@@index([status])
@@map("world_uploads")
}