{"record":{"id":"24ffdf7e02f67161","repo":"beekeeper-studio/beekeeper-studio","slug":"column-reordering-is-not-supported-in-surrealdb","errorCode":null,"errorMessage":"Column reordering is not supported in SurrealDB.","messagePattern":"Column reordering is not supported in SurrealDB\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/studio/src/shared/lib/sql/change_builder/SurrealDBChangeBuilder.ts","lineNumber":176,"sourceCode":"          default:\n            return null;\n        }\n      }).filter(s => s !== null);\n      \n      statements.push(...alterations);\n    }\n\n    if (statements.length === 0) {\n      return null;\n    }\n\n    const result = statements.join('; ');\n    return result.endsWith(';') ? result : `${result};`;\n  }\n\n  // Column reordering is not supported in SurrealDB\n  reorderColumns(): string {\n    throw new Error('Column reordering is not supported in SurrealDB.');\n  }\n}","sourceCodeStart":158,"sourceCodeEnd":178,"githubUrl":"https://github.com/beekeeper-studio/beekeeper-studio/blob/4e3e03e3223b2b71a1af8926d455f533b80af837/apps/studio/src/shared/lib/sql/change_builder/SurrealDBChangeBuilder.ts#L158-L178","documentation":"SurrealDB stores schemaless/schema-full records without positional column ordering, so reordering columns has no meaning in its data model. SurrealDBChangeBuilder.reorderColumns() unconditionally throws 'Column reordering is not supported in SurrealDB.'","triggerScenarios":"Any call to reorderColumns() — e.g. drag-and-drop column reordering in a structured table editor applied to a SurrealDB table.","commonSituations":"Using a generic reorder-columns UI built for SQL databases against SurrealDB; SQL migration scripts containing ALTER TABLE ... column order adjustments; ORM features that assume column order.","solutions":["Do not call reorderColumns for SurrealDB; disable the reorder interaction when the dialect is surrealdb.","Handle presentation-order concerns in the application layer rather than in DDL.","Branch on dialect capability before issuing any column-order change."],"exampleFix":"// before\nbuilder.reorderColumns()\n// after\nif (dialect !== 'surrealdb') builder.reorderColumns()","handlingStrategy":"validation","validationCode":"if (dialect === 'surrealdb') {\n  // column order is meaningless in SurrealDB; skip DDL, order is presentation-only\n  return\n}\nbuilder.reorderColumns()","typeGuard":"const supportsColumnReorder = (dialect: string) => dialect !== 'surrealdb'","tryCatchPattern":"try {\n  stmt = builder.reorderColumns()\n} catch (e) {\n  if (e.message.includes('reordering')) {\n    saveColumnOrderAsUiPreferenceOnly() // no DDL for SurrealDB\n  } else throw e\n}","preventionTips":["Disable drag-to-reorder for SurrealDB columns in the table designer.","Treat column order as a UI preference, not a database attribute, for SurrealDB.","Check dialect capability before generating order-dependent DDL.","Note the limitation in docs for script/plugin authors."],"tags":["surrealdb","unsupported-feature","schema"],"backgroundTag":"unsupported-database-feature","analyzedSha":"4e3e03e3223b2b71a1af8926d455f533b80af837","analyzedAt":"2026-08-31T23:21:23.379Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}