{"record":{"id":"846824e9410ab5f8","repo":"Budibase/budibase","slug":"only-user-relationship-migration-columns-is-curren","errorCode":null,"errorMessage":"Only user relationship migration columns is currently supported","messagePattern":"Only user relationship migration columns is currently supported","errorType":"validation","errorClass":"BadRequestError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/tables/migration.ts","lineNumber":56,"sourceCode":"  }\n\n  if (isInternalColumnName(newColumnName)) {\n    throw new BadRequestError(`Column name cannot be a reserved column name`)\n  }\n\n  const oldColumn = table.schema[oldColumnName]\n\n  if (!oldColumn) {\n    throw new BadRequestError(\n      `Column \"${oldColumnName}\" does not exist on table \"${table.name}\"`\n    )\n  }\n\n  if (\n    oldColumn.type !== FieldType.LINK ||\n    oldColumn.tableId !== InternalTable.USER_METADATA\n  ) {\n    throw new BadRequestError(\n      `Only user relationship migration columns is currently supported`\n    )\n  }\n\n  const type =\n    oldColumn.relationshipType === RelationshipType.ONE_TO_MANY\n      ? FieldType.BB_REFERENCE_SINGLE\n      : FieldType.BB_REFERENCE\n  const newColumn: FieldSchema = {\n    name: newColumnName,\n    type,\n    subtype: BBReferenceFieldSubType.USER,\n  }\n\n  if (newColumn.type === FieldType.BB_REFERENCE) {\n    newColumn.constraints = {\n      type: \"array\",\n    }","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/tables/migration.ts#L38-L74","documentation":"The migration API currently only converts relationship (FieldType.LINK) columns that point at the internal user metadata table into bb-reference user columns; any other column type or link target is rejected with this BadRequestError.","triggerScenarios":"Calling migrate(table, oldColumnName, newColumnName) where the old column is not a LINK column, or is a link to a table other than InternalTable.USER_METADATA (e.g. a regular one-to-many relationship to a custom table).","commonSituations":"Attempting to migrate ordinary relationship columns to references; migrating links to non-user tables; calling the migration API generically across all link columns in a schema.","solutions":["Only call migrate on LINK columns whose tableId === InternalTable.USER_METADATA","For other relationship-to-reference conversions, recreate the column as a bb-reference and re-link data manually","Filter the schema before looping migrations: `col.type === FieldType.LINK && col.tableId === InternalTable.USER_METADATA`","Wait for/extend the migration implementation if you need support for other link targets"],"exampleFix":"// before\nfor (const col of Object.values(table.schema)) {\n  await sdk.tables.migration.migrate(table, col.name, col.name + 'Ref')\n}\n// after\nfor (const col of Object.values(table.schema)) {\n  if (col.type === FieldType.LINK && col.tableId === InternalTable.USER_METADATA) {\n    await sdk.tables.migration.migrate(table, col.name, col.name + 'Ref')\n  }\n}","handlingStrategy":"validation","validationCode":"function isMigratableUserLink(col: FieldSchema | undefined): boolean {\n  return !!col && col.type === FieldType.LINK &&\n    (col as RelationshipFieldMetadata).tableId === InternalTable.USER_METADATA\n}","typeGuard":"function isUserRelationshipColumn(col: FieldSchema | undefined): col is RelationshipFieldMetadata {\n  return !!col && col.type === FieldType.LINK &&\n    (col as RelationshipFieldMetadata).tableId === InternalTable.USER_METADATA\n}","tryCatchPattern":"try {\n  await sdk.tables.migration.migrate(table, oldName, newName)\n} catch (e) {\n  if (e.message.includes('Only user relationship migration')) {\n    // migrate manually or restrict which columns you migrate\n  }\n}","preventionTips":["Only call migrate on LINK columns pointing at InternalTable.USER_METADATA","Filter schemas before batch migrations","Handle other relationship conversions manually (recreate as bb-reference + relink)","Track the migration API's supported scope before generalizing it"],"tags":["migration","relationships","unsupported"],"backgroundTag":"unsupported-column-migration","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}