Skip to content

Beautiful Open-Source Form Builder

Fix self-hosted custom code entitlement (#1206)

Julien Nahum6f9b9637055c
diff --git a/api/app/Models/LicenseKey.php b/api/app/Models/LicenseKey.php
index 2969dff65..e53bc5076 100644
--- a/api/app/Models/LicenseKey.php
+++ b/api/app/Models/LicenseKey.php
@@ -66,6 +66,7 @@ class LicenseKey extends Model
'custom_smtp' => true,
'audit_logs' => true,
'external_storage' => true,
+ 'custom_code' => true,
];
}
}
diff --git a/api/database/migrations/2026_07_14_000000_add_custom_code_to_self_hosted_license_features.php b/api/database/migrations/2026_07_14_000000_add_custom_code_to_self_hosted_license_features.php
new file mode 100644
index 000000000..d539844a9
--- /dev/null
+++ b/api/database/migrations/2026_07_14_000000_add_custom_code_to_self_hosted_license_features.php
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\DB;
+
+return new class () extends Migration {
+ public function up(): void
+ {
+ DB::table('license_keys')
+ ->where('plan', 'self_hosted')
+ ->chunkById(1000, function ($licenseKeys): void {
+ foreach ($licenseKeys as $licenseKey) {
+ $features = json_decode($licenseKey->features ?? '[]', true) ?: [];
+
+ if (($features['custom_code'] ?? false) === true) {
+ continue;
+ }
+
+ $features['custom_code'] = true;
+
+ DB::table('license_keys')
+ ->where('id', $licenseKey->id)
+ ->update([
+ 'features' => json_encode($features),
+ 'updated_at' => now(),
+ ]);
+ }
+ });
+ }
+
+ public function down(): void
+ {
+ // Existing licenses may have been issued with this entitlement, so leave it intact on rollback.
+ }
+};
diff --git a/api/tests/Feature/SelfHosted/LicenseKeyServiceTest.php b/api/tests/Feature/SelfHosted/LicenseKeyServiceTest.php
index 65d7e4249..5fe3794f1 100644
--- a/api/tests/Feature/SelfHosted/LicenseKeyServiceTest.php
+++ b/api/tests/Feature/SelfHosted/LicenseKeyServiceTest.php
@@ -47,6 +47,8 @@ describe('generateKeyForSession', function () {
expect($key->status)->toBe('active');
expect($key->plan)->toBe('self_hosted');
expect($key->features)->toHaveKey('sso');
+ expect($key->features)->toHaveKey('custom_code');
+ expect($key->features['custom_code'])->toBeTrue();
expect(LicenseCheckoutSession::where('stripe_session_id', 'cs_test_session')->value('license_key_id'))->toBe($key->id);
});
diff --git a/docs/deployment/self-hosted-license.mdx b/docs/deployment/self-hosted-license.mdx
index 3d55d1a5c..8d83d8270 100644
--- a/docs/deployment/self-hosted-license.mdx
+++ b/docs/deployment/self-hosted-license.mdx
@@ -59,8 +59,8 @@ Self-hosted Enterprise unlocks advanced workspace and organization controls:
| Custom code | Workspace and form custom code when enabled for self-hosted deployments |
<Note>
- Your license key controls which Enterprise areas are enabled. Some licenses
- may include a subset of Enterprise features.
+ An active self-hosted Enterprise license enables every Enterprise feature
+ listed above for the instance.
</Note>
## Instance configuration vs Enterprise workspace features