{"record":{"id":"0655834b27524ca1","repo":"windmill-labs/windmill","slug":"data-table-datatable-has-not-opted-in-to-migr","errorCode":null,"errorMessage":"Data table '${datatable}' has not opted in to migrations on the target workspace; enable migrations for it there before deploying its migrations.","messagePattern":"Data table '(.+?)' has not opted in to migrations on the target workspace; enable migrations for it there before deploying its migrations\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/windmill-utils-internal/src/deploy.ts","lineNumber":778,"sourceCode":"        throw new Error(\n          `Datatable migration ${path} not found in ${workspaceFrom}`\n        );\n      }\n      try {\n        await provider.upsertDatatableMigration({\n          workspace: workspaceTo,\n          datatableName: datatable,\n          requestBody: {\n            timestamp: migration.timestamp,\n            name: migration.name,\n            code_up: migration.code_up,\n            ...(migration.code_down != null\n              ? { code_down: migration.code_down }\n              : {}),\n          },\n        });\n      } catch (e) {\n        throw asMigrationsDisabledError(e, datatable);\n      }\n    } else {\n      throw new Error(`Unknown kind: ${kind}`);\n    }\n\n    return { success: true };\n  } catch (e: unknown) {\n    return { success: false, error: toError(e) };\n  }\n}\n\n// ---------------------------------------------------------------------------\n// deleteItemInWorkspace\n// ---------------------------------------------------------------------------\n\n/**\n * Delete/archive an item in a workspace.\n * Scripts and flows are archived (reversible). Other types are deleted.","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/windmill-utils-internal/src/deploy.ts#L760-L796","documentation":"Deploying a data table migration item fails because the target workspace has migrations disabled for that data table. The CLI wraps the underlying error with asMigrationsDisabledError to tell you to enable migrations on the target workspace first.","triggerScenarios":"Running a deploy (deployItem, kind: migrations for a datatable) where the API call to create/update the migration fails because the datatable has not opted in to migrations on the target workspace.","commonSituations":"Deploying to a new workspace where the datatable was created without migrations enabled; promotion to prod where the datatable exists but its migration opt-in was never switched on; environment drift between dev and prod workspaces.","solutions":["Enable migrations for the data table in the target workspace (datatable settings), then redeploy","Create the datatable on the target workspace with migrations opted in before deploying its migrations","Verify you are deploying to the intended workspace (wrong workspace can lack the opt-in)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const dt = await fetch(`${remote}api/w/${workspaceId}/datatables/list`).then(r => r.json()); const target = dt.find(d => d.name === datatable); if (!target?.migrations_enabled) throw new Error(`Enable migrations for datatable '${datatable}' on the target workspace before deploy`);","typeGuard":null,"tryCatchPattern":"try { await deployMigrations(items); } catch (e) { if (String(e.message).includes('has not opted in to migrations')) { console.error('Enable migrations on the target workspace datatable, then redeploy.'); } else throw e; }","preventionTips":["When creating a datatable on a new workspace, opt in to migrations at creation time","Mirror datatable migration settings across dev/staging/prod","Verify the target workspace name in the deploy config before promotion"],"tags":["datatables","migrations","deploy","workspace-config"],"backgroundTag":"migrations-not-enabled","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}