{"record":{"id":"ddcaed54ba10e337","repo":"paperclipai/paperclip","slug":"plugin-migration-objects-must-use-fully-qualified","errorCode":null,"errorMessage":"Plugin migration objects must use fully qualified schema names","messagePattern":"Plugin migration objects must use fully qualified schema names","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-database.ts","lineNumber":217,"sourceCode":"  if (/^\\s*(drop|truncate)\\b/.test(normalized)) {\n    throw new Error(\"Destructive plugin migrations are not allowed in Phase 1\");\n  }\n\n  if (/\\bdelete\\s+from\\b/.test(normalized)) {\n    throw new Error(\"Plugin migrations cannot delete data\");\n  }\n\n  const ddlOrBackfillAllowed =\n    /^(create|alter|comment)\\b/.test(normalized) ||\n    /^(insert\\s+into|update)\\b/.test(normalized) ||\n    (normalized.startsWith(\"with \") && /\\b(insert\\s+into|update)\\b/.test(normalized));\n  if (!ddlOrBackfillAllowed) {\n    throw new Error(\"Plugin migrations may contain DDL or namespace-scoped backfill statements only\");\n  }\n\n  const refs = extractQualifiedRefs(statement);\n  if (refs.length === 0 && !normalized.startsWith(\"comment \")) {\n    throw new Error(\"Plugin migration objects must use fully qualified schema names\");\n  }\n\n  const objectRefKeywords = new Set([\n    \"alter table\",\n    \"create index\",\n    \"create table\",\n    \"create view\",\n    \"drop table\",\n    \"into\",\n    \"truncate table\",\n    \"update\",\n  ]);\n  const hasQualifiedObjectRef = refs.some((ref) => objectRefKeywords.has(ref.keyword));\n  if (!hasQualifiedObjectRef && !normalized.startsWith(\"comment \")) {\n    throw new Error(\"Plugin migration objects must use fully qualified schema names\");\n  }\n\n  const allowedCoreReadTables = new Set(coreReadTables);","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/plugin-database.ts#L199-L235","documentation":"Qualification guard: the migration statement contains no schema-qualified object reference (create table/view, drop table, into, truncate table, update, alter) and is not a comment. Unqualified objects would land in the wrong schema (typically public), so migrations must name the plugin namespace explicitly; the unqualified migration is at fault.","triggerScenarios":"Thrown at server/src/services/plugin-database.ts:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Qualify all object names in the migration with the plugin's schema name."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}