{"record":{"id":"1bcc2d069c4ba595","repo":"cube-js/cube","slug":"the-keybydatasource-cubejs-database-datasourc-1bcc2d","errorCode":null,"errorMessage":"The ${keyByDataSource('CUBEJS_DATABASE', dataSource)} is deprecated. Please, use the ${keyByDataSource('CUBEJS_DB_NAME', dataSource)} instead.","messagePattern":"The (.+?) is deprecated\\. Please, use the (.+?) instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cubejs-backend-shared/src/env.ts","lineNumber":631,"sourceCode":"      );\n    }\n    return val;\n  },\n\n  /**\n   * Database name.\n   * @deprecated\n   */\n  dbDatabase: ({\n    required,\n    dataSource,\n    preAggregations,\n  }: {\n    dataSource: string,\n    required?: boolean,\n    preAggregations?: boolean,\n  }) => {\n    console.warn(\n      `The ${\n        keyByDataSource('CUBEJS_DATABASE', dataSource)\n      } is deprecated. Please, use the ${\n        keyByDataSource('CUBEJS_DB_NAME', dataSource)\n      } instead.`\n    );\n    const val = get(keyByDataSource('CUBEJS_DATABASE', dataSource, preAggregations)).asString();\n    if (required && !val) {\n      throw new Error(\n        `The ${\n          keyByDataSource('CUBEJS_DATABASE', dataSource)\n        } is required and missing.`\n      );\n    }\n    return val;\n  },\n\n  /**","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/env.ts#L613-L649","documentation":"The legacy CUBEJS_DATABASE (and per-datasource suffixed variants) env var is deprecated in favor of CUBEJS_DB_NAME. Cube logs this warning when the deprecated var is read, but still returns its value for compatibility.","triggerScenarios":"env dbDatabase (or equivalent) is called for a datasource whose environment defines CUBEJS_DATABASE or CUBEJS_DATABASE_<DATA_SOURCE>.","commonSituations":"Very old deployment templates; migrations from legacy Cube versions; multi-tenant environments with suffixed vars like CUBEJS_DATABASE_DB1.","solutions":["Replace CUBEJS_DATABASE with CUBEJS_DB_NAME (suffixed variants become CUBEJS_DB_NAME_<DATA_SOURCE>)","Remove the old variable after verifying the new one is picked up","Restart the Cube process and confirm the warning is gone"],"exampleFix":"// before\nCUBEJS_DATABASE=warehouse\n// after\nCUBEJS_DB_NAME=warehouse","handlingStrategy":"validation","validationCode":"if (process.env.CUBEJS_DATABASE) console.warn('Use CUBEJS_DB_NAME instead of deprecated CUBEJS_DATABASE');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate legacy variable names during upgrade windows","Maintain a single source of truth for env config","Test datasources after renaming env vars"],"tags":["env","deprecation","config"],"backgroundTag":"deprecated-env-var","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}