Skip to content

Commit 1dff20d

Browse files
authored
fix(ee): Wipe search contexts on init if we no longer have the entitlement (#618)
1 parent fbe1073 commit 1dff20d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111
- Fixed spurious infinite loads with explore panel, file tree, and file search command. [#617](https://github.com/sourcebot-dev/sourcebot/pull/617)
12+
- Wipe search context on init if entitlement no longer exists [#618](https://github.com/sourcebot-dev/sourcebot/pull/618)
1213

1314
## [4.9.2] - 2025-11-13
1415

packages/web/src/initialize.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ const initSingleTenancy = async () => {
6262
}
6363
}
6464

65+
// If we don't have the search context entitlement then wipe any existing
66+
// search contexts that may be present in the DB. This could happen if a deployment had
67+
// the entitlement, synced search contexts, and then no longer had the entitlement
68+
const hasSearchContextEntitlement = hasEntitlement("search-contexts")
69+
if(!hasSearchContextEntitlement) {
70+
await prisma.searchContext.deleteMany({
71+
where: {
72+
orgId: SINGLE_TENANT_ORG_ID,
73+
},
74+
});
75+
}
76+
6577
// Sync anonymous access config from the config file
6678
const config = await loadConfig(env.CONFIG_PATH);
6779
const forceEnableAnonymousAccess = config.settings?.enablePublicAccess ?? env.FORCE_ENABLE_ANONYMOUS_ACCESS === 'true';

0 commit comments

Comments
 (0)