You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3bed99b
Browse filesBrowse the repository at this point in the historyBrowse files
Migration `0427_file_search_owner_scope.sql` adds canonical workspace/Project ownership to the existing build, revision, and chunk pipeline. Legacy workspace inserts are translated by triggers, and the existing workspace trigram index remains usable. Project rows use a separate owner-scoped trigram index on the same chunk table. Organizations and personal users are not enabled search owners.
72
+
Migration `0426_file_search_owner_scope.sql` adds canonical workspace/Project ownership to the existing build, revision, and chunk pipeline. Legacy workspace inserts are translated by triggers, and the existing workspace trigram index remains usable. Project rows use a separate owner-scoped trigram index on the same chunk table. Organizations and personal users are not enabled search owners.
73
73
74
74
The new `file_search_dispatch_queue` replaces the workspace-keyed scheduler because older workers cannot decode a Project without a workspace. During expansion, workspace mutations enqueue both queues, while the new dispatcher reads the owner queue. Both deployments share the dispatcher lock, revision claim token, build lease, and publication fence. Drain old app dispatchers and Trigger workers/retries before enabling Project dispatch. Retire the legacy queue and its dual enqueue in a later contract deploy; they are not a second indexing pipeline. The `file-search-owners-v3` cursor performs bounded owner/file keyset backfill and hourly reconciliation without rewriting extracted text in the migration.
Copy file name to clipboardExpand all lines: packages/db/migrations/0423_file_folder_version_ownership.sql
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -165,14 +165,17 @@ FOR EACH ROW EXECUTE FUNCTION workspace_file_version_owner_match();--> statement
165
165
CREATE OR REPLACEFUNCTIONproject_file_uploader_delete_guard()
166
166
RETURNS trigger LANGUAGE plpgsql AS $$
167
167
BEGIN
168
-
IF EXISTS (SELECT1FROM workspace_files WHERE project_id IS NOT NULLAND user_id =OLD.id)
169
-
OR EXISTS (SELECT1FROM folder WHERE project_id IS NOT NULLAND user_id =OLD.id) THEN
170
-
RAISE EXCEPTION 'Project file and folder attribution must be reassigned or retired before deleting its creator'
171
-
USING ERRCODE ='23503';
168
+
IF EXISTS (SELECT1FROM workspace_files WHERE user_id =OLD.idAND project_id IS NOT NULL)
169
+
OR EXISTS (SELECT1FROM folder WHERE user_id =OLD.idAND project_id IS NOT NULL) THEN
170
+
RAISE EXCEPTION 'Project resource creators must be handed to a successor before account deletion' USING ERRCODE ='23514', CONSTRAINT='project_resource_creator_handoff';
172
171
END IF;
173
172
RETURN OLD;
174
173
END;
175
174
$$;--> statement-breakpoint
175
+
DROPTRIGGER IF EXISTS project_file_uploader_delete_guard ON"user";--> statement-breakpoint
176
+
CREATETRIGGERproject_file_uploader_delete_guard
177
+
BEFORE DELETEON"user"
178
+
FOR EACH ROW EXECUTE FUNCTION project_file_uploader_delete_guard();--> statement-breakpoint
176
179
COMMIT;--> statement-breakpoint
177
180
SET lock_timeout =0;--> statement-breakpoint
178
181
DROPINDEX CONCURRENTLY IF EXISTS "folder_project_id_idx";--> statement-breakpoint
0 commit comments