windmill-labs/windmill · error · Error

Data table '${datatable}' has not opted in to migrations on

Error message

Data table '${datatable}' has not opted in to migrations on the target workspace; enable migrations for it there before deploying its migrations.

What it means

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.

Source

Thrown at cli/windmill-utils-internal/src/deploy.ts:778

        throw new Error(
          `Datatable migration ${path} not found in ${workspaceFrom}`
        );
      }
      try {
        await provider.upsertDatatableMigration({
          workspace: workspaceTo,
          datatableName: datatable,
          requestBody: {
            timestamp: migration.timestamp,
            name: migration.name,
            code_up: migration.code_up,
            ...(migration.code_down != null
              ? { code_down: migration.code_down }
              : {}),
          },
        });
      } catch (e) {
        throw asMigrationsDisabledError(e, datatable);
      }
    } else {
      throw new Error(`Unknown kind: ${kind}`);
    }

    return { success: true };
  } catch (e: unknown) {
    return { success: false, error: toError(e) };
  }
}

// ---------------------------------------------------------------------------
// deleteItemInWorkspace
// ---------------------------------------------------------------------------

/**
 * Delete/archive an item in a workspace.
 * Scripts and flows are archived (reversible). Other types are deleted.

View on GitHub (pinned to e474e8803c)

Solutions

  1. Enable migrations for the data table in the target workspace (datatable settings), then redeploy
  2. Create the datatable on the target workspace with migrations opted in before deploying its migrations
  3. Verify you are deploying to the intended workspace (wrong workspace can lack the opt-in)
Defensive patterns

Strategy: validation

Validate before calling

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`);

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/0655834b27524ca1. Report an issue: GitHub.