diff --git a/app/Actions/Docker/GetContainersStatus.php b/app/Actions/Docker/GetContainersStatus.php index df0d8cf14..3631cca24 100644 --- a/app/Actions/Docker/GetContainersStatus.php +++ b/app/Actions/Docker/GetContainersStatus.php @@ -206,28 +206,19 @@ public function handle(Server $server, ?Collection $containers = null, ?Collecti if ($statusFromDb !== $containerStatus) { $updateData = ['status' => $containerStatus]; - - // Update restart tracking if restart count increased - if ($restartCount > $previousRestartCount) { - $updateData['restart_count'] = $restartCount; - $updateData['last_restart_at'] = now(); - $updateData['last_restart_type'] = 'crash'; - } - - $database->update($updateData); } else { $updateData = ['last_online_at' => now()]; - - // Update restart tracking even if status unchanged - if ($restartCount > $previousRestartCount) { - $updateData['restart_count'] = $restartCount; - $updateData['last_restart_at'] = now(); - $updateData['last_restart_type'] = 'crash'; - } - - $database->update($updateData); } + // Update restart tracking if restart count increased + if ($restartCount > $previousRestartCount) { + $updateData['restart_count'] = $restartCount; + $updateData['last_restart_at'] = now(); + $updateData['last_restart_type'] = 'crash'; + } + + $database->update($updateData); + if ($isPublic) { $foundTcpProxy = $this->containers->filter(function ($value, $key) use ($uuid) { if ($this->server->isSwarm()) { diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.php index 63485c612..a76d55abb 100644 --- a/app/Models/StandaloneClickhouse.php +++ b/app/Models/StandaloneClickhouse.php @@ -20,6 +20,7 @@ class StandaloneClickhouse extends BaseModel 'clickhouse_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.php index 09f16752d..f5337b1d5 100644 --- a/app/Models/StandaloneDragonfly.php +++ b/app/Models/StandaloneDragonfly.php @@ -20,6 +20,7 @@ class StandaloneDragonfly extends BaseModel 'dragonfly_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.php index c420bde15..ab24cae2c 100644 --- a/app/Models/StandaloneKeydb.php +++ b/app/Models/StandaloneKeydb.php @@ -20,6 +20,7 @@ class StandaloneKeydb extends BaseModel 'keydb_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php index 52ae136bb..e48cfc1e6 100644 --- a/app/Models/StandaloneMariadb.php +++ b/app/Models/StandaloneMariadb.php @@ -21,6 +21,7 @@ class StandaloneMariadb extends BaseModel 'mariadb_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php index f17c72dbc..9e271b19a 100644 --- a/app/Models/StandaloneMongodb.php +++ b/app/Models/StandaloneMongodb.php @@ -19,6 +19,7 @@ class StandaloneMongodb extends BaseModel protected $casts = [ 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php index f4e192047..377765697 100644 --- a/app/Models/StandaloneMysql.php +++ b/app/Models/StandaloneMysql.php @@ -21,6 +21,7 @@ class StandaloneMysql extends BaseModel 'mysql_root_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php index 9e6c968aa..d9993426a 100644 --- a/app/Models/StandalonePostgresql.php +++ b/app/Models/StandalonePostgresql.php @@ -21,6 +21,7 @@ class StandalonePostgresql extends BaseModel 'postgres_password' => 'encrypted', 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted() diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php index 05f8ae6c6..684bcaeb7 100644 --- a/app/Models/StandaloneRedis.php +++ b/app/Models/StandaloneRedis.php @@ -19,6 +19,7 @@ class StandaloneRedis extends BaseModel protected $casts = [ 'restart_count' => 'integer', 'last_restart_at' => 'datetime', + 'last_restart_type' => 'string', ]; protected static function booted()