From 8e61b2149f1b5e538b210dbde947b644904627b4 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 22 Jul 2024 11:33:31 +0900 Subject: [PATCH] Auto update V3 Runtimes into V4 Runtimes on execution --- app/controllers/api/functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index d2a1790d94..a810d7be5b 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1621,6 +1621,13 @@ App::post('/v1/functions/:functionId/executions') $version = $function->getAttribute('version', 'v2'); $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); + /** Auto-update v3 runtimes into v4, remove me after we do migrations */ + if ($version === 'v3') { + $function->setAttribute('version', 'v4'); + $function = $dbForProject->updateDocument('functions', $function->getId(), $function); + $version = 'v4'; + } + $runtime = (isset($runtimes[$function->getAttribute('runtime', '')])) ? $runtimes[$function->getAttribute('runtime', '')] : null; if (\is_null($runtime)) {