Error: Failed to run sql query: {"error":"ERROR: 23514: new row for relation "invite_codes" violates check constraint "invite_codes_role_check"\nDETAIL: Failing row contains (20f965c1-d3dd-4cbf-8e5f-6a8f732974ef, TDVIP-ADMIN-2025, admin, null, null, null, 2026-10-12 02:30:48.897174+00, 2025-10-12 02:30:48.897174+00).\n","length":364,"name":"error","severity":"ERROR","code":"23514","detail":"Failing row contains (20f965c1-d3dd-4cbf-8e5f-6a8f732974ef, TDVIP-ADMIN-2025, admin, null, null, null, 2026-10-12 02:30:48.897174+00, 2025-10-12 02:30:48.897174+00).","schema":"public","table":"invite_codes","constraint":"invite_codes_role_check","file":"execMain.c","line":"2033","routine":"ExecConstraints","message":"new row for relation "invite_codes" violates check constraint "invite_codes_role_check"","formattedError":"ERROR: 23514: new row for relation "invite_codes" violates check constraint "invite_codes_role_check"\nDETAIL: Failing row contains (20f965c1-d3dd-4cbf-8e5f-6a8f732974ef, TDVIP-ADMIN-2025, admin, null, null, null, 2026-10-12 02:30:48.897174+00, 2025-10-12 02:30:48.897174+00).\n"}
I found the issue! The invite_codes table has a check constraint that only allows 'creator' and 'user' roles, but I'm trying to insert an 'admin' invite code. Let me fix this by creating an updated script.
I've fixed the issue by updating the check constraint on the invite_codes table to include 'admin' as a valid role. Run the new script 001_create_profiles_and_invite_codes_v2.sql instead of the original one, then continue with the other three scripts in order.
To configure the generation, complete these steps:
Good! The v2 script looks correct with 'admin' included in both constraints. Now let me check the other scripts to make sure they don't have any dependency issues.
All the other scripts look good. The issue was only in the first script with the check constraint not including 'admin'. The v2 script I created fixes this issue.
The corrected script now allows 'admin', 'creator', and 'user' roles in both the profiles and invite_codes tables, which will allow the admin invite code to be inserted successfully. All other scripts (002, 003, 004) are fine and will run without issues once the first script completes.
To fix the error, run the scripts in this order:
scripts/001_create_profiles_and_invite_codes_v2.sql (the fixed version)scripts/002_create_posts_and_feed.sqlscripts/003_create_messages.sqlscripts/004_create_media_and_subscriptions.sql