Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(db): only widen avatars_source_check where the constraint exists in the target database

nirholasde9d80d79378
diff --git a/api/_lib/migrations/20261015070000_vroid_hub_source.sql b/api/_lib/migrations/20261015070000_vroid_hub_source.sql
index f62f71565..14833010d 100644
--- a/api/_lib/migrations/20261015070000_vroid_hub_source.sql
+++ b/api/_lib/migrations/20261015070000_vroid_hub_source.sql
@@ -5,10 +5,18 @@
-- the shape already varies by provider (see api/_lib/vroid/license.js) and
-- jsonb is where every other provider's import metadata already lives.
-ALTER TABLE avatars
-DROP CONSTRAINT avatars_source_check,
-ADD CONSTRAINT avatars_source_check
- CHECK (source = ANY (ARRAY[
- 'upload', 'avaturn', 'readyplayer', 'import',
- 'direct-upload', 'reconstruct', 'studio', 'forge', 'fork', 'vroid_hub'
- ]));
+-- Databases without avatars_source_check already accept any source value, so
+-- the constraint is only widened where it exists.
+DO $$
+BEGIN
+ IF EXISTS (SELECT 1 FROM pg_constraint
+ WHERE conrelid = 'avatars'::regclass AND conname = 'avatars_source_check') THEN
+ ALTER TABLE avatars
+ DROP CONSTRAINT avatars_source_check,
+ ADD CONSTRAINT avatars_source_check
+ CHECK (source = ANY (ARRAY[
+ 'upload', 'avaturn', 'readyplayer', 'import',
+ 'direct-upload', 'reconstruct', 'studio', 'forge', 'fork', 'vroid_hub'
+ ]));
+ END IF;
+END $$;