0

I am looking through Dynamic Cube Creation and was wondering - is there a way to get a cube created post Cube process startup?

In this use case, we have multiple schemas being created on the fly as users navigate through a front end app, and, will need to have some cubes created when those schemas are created. Initially, the search began for a Cube endpoint to allow the creation of cubes, but, it doesn't seem to be out there.

I have seen this question: How to dynamically generate schema for cube.js?, but, I don't see how it could work for the above use case, and, in the selected answer, there is a mention of a tenant-by-tenant basis, which, we are not in need of.

steamrolla
  • 2,373
  • 1
  • 29
  • 39

1 Answers1

0

It's possible to trigger an update on the compilation of schemas. Take a look at Schema Versioning.

module.exports = {
  schemaVersion: async ({ securityContext }) => {
    const schemaVersions = await (
      await fetch('http://your-api-endpoint/schemaVersion')
    ).json();

    return schemaVersions['version'];
  },
};

Basically, you need to do a version increment every time the underlying data schema has changed. I modified the example from the docs removing multitenancy just to show how you would have to create the response from your API.

Paco Valdez
  • 1,915
  • 14
  • 26