diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index 00475665e9..750dc5a9c5 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -204,7 +204,7 @@ App::post('/v1/migrations/appwrite') 'status' => 'pending', 'stage' => 'init', 'source' => json_encode([ - 'type' => 'appwrite', + 'type' => Appwrite::getName(), 'endpoint' => $endpoint, 'projectId' => $projectId, 'apiKey' => $apiKey, @@ -288,7 +288,7 @@ App::post('/v1/migrations/firebase') 'status' => 'pending', 'stage' => 'init', 'source' => json_encode([ - 'type' => 'firebase', + 'type' => Firebase::getName(), 'serviceAccount' => $serviceAccount, ]), 'resources' => $resources, @@ -376,7 +376,7 @@ App::post('/v1/migrations/supabase') 'status' => 'pending', 'stage' => 'init', 'source' => json_encode([ - 'type' => 'supabase', + 'type' => Supabase::getName(),, 'endpoint' => $endpoint, 'apiKey' => $apiKey, 'databaseHost' => $databaseHost, @@ -473,7 +473,7 @@ App::post('/v1/migrations/nhost') 'status' => 'pending', 'stage' => 'init', 'source' => json_encode([ - 'type' => 'nhost', + 'type' => NHost::getName(),, 'subdomain' => $subdomain, 'region' => $region, 'adminSecret' => $adminSecret, diff --git a/app/workers/migrations.php b/app/workers/migrations.php index 8c377d2fe4..56388a3c20 100644 --- a/app/workers/migrations.php +++ b/app/workers/migrations.php @@ -78,12 +78,12 @@ class MigrationsV1 extends Worker protected function processSource(array $source): Source { switch ($source['type']) { - case 'firebase': + case Firebase::getName(): return new Firebase( json_decode($source['serviceAccount'], true), ); break; - case 'supabase': + case Supabase::getName(): return new Supabase( $source['endpoint'], $source['apiKey'], @@ -94,7 +94,7 @@ class MigrationsV1 extends Worker $source['port'], ); break; - case 'nhost': + case NHost::getName(): return new NHost( $source['subdomain'], $source['region'], @@ -105,7 +105,7 @@ class MigrationsV1 extends Worker $source['port'], ); break; - case 'appwrite': + case Appwrite::getName(): return new Appwrite($source['projectId'], str_starts_with($source['endpoint'], 'http://localhost/v1') ? 'http://appwrite/v1' : $source['endpoint'], $source['apiKey']); break; default: