Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: No joinBy dimension found in cube #1574

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 77 additions & 2 deletions app/utils/chart-config/versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Migration = {
down: (config: any, migrationProps?: any) => any;
};

export const CHART_CONFIG_VERSION = "3.2.0";
export const CHART_CONFIG_VERSION = "3.3.0";

export const chartConfigMigrations: Migration[] = [
{
Expand Down Expand Up @@ -861,6 +861,7 @@ export const chartConfigMigrations: Migration[] = [
description: `ALL {
+ cubes {
+ publishIri
+- joinBy (string) -> joinBy (string[])
}
}`,
from: "3.1.0",
Expand All @@ -886,6 +887,41 @@ export const chartConfigMigrations: Migration[] = [
});
},
},
{
description: `ALL {
+ cubes {
+- joinBy (string) -> joinBy (string[])
}
}`,
from: "3.2.0",
to: "3.3.0",
up: (config) => {
const newConfig = { ...config, version: "3.3.0" };

return produce(newConfig, (draft: any) => {
draft.cubes = draft.cubes.map((cube: any) => {
if (typeof cube.joinBy === "string") {
cube.joinBy = [cube.joinBy];
}

return cube;
});
});
},
down: (config) => {
const newConfig = { ...config, version: "3.2.0" };

return produce(newConfig, (draft: any) => {
draft.cubes = draft.cubes.map((cube: any) => {
if (cube.joinBy) {
cube.joinBy = cube.joinBy[0];
}

return cube;
});
});
},
},
];

export const migrateChartConfig = makeMigrate<ChartConfig>(
Expand All @@ -895,7 +931,7 @@ export const migrateChartConfig = makeMigrate<ChartConfig>(
}
);

export const CONFIGURATOR_STATE_VERSION = "3.3.0";
export const CONFIGURATOR_STATE_VERSION = "3.4.0";

export const configuratorStateMigrations: Migration[] = [
{
Expand Down Expand Up @@ -1157,6 +1193,45 @@ export const configuratorStateMigrations: Migration[] = [
return newConfig;
},
},
{
description: "ALL (bump ChartConfig version)",
from: "3.3.0",
to: "3.4.0",
up: (config) => {
const newConfig = { ...config, version: "3.4.0" };

return produce(newConfig, (draft: any) => {
const chartConfigs: any[] = [];

for (const chartConfig of draft.chartConfigs) {
const migratedChartConfig = migrateChartConfig(chartConfig, {
migrationProps: draft,
toVersion: "3.3.0",
});
chartConfigs.push(migratedChartConfig);
}

draft.chartConfigs = chartConfigs;
});
},
down: (config) => {
const newConfig = { ...config, version: "3.3.0" };

return produce(newConfig, (draft: any) => {
const chartConfigs: any[] = [];

for (const chartConfig of draft.chartConfigs) {
const migratedChartConfig = migrateChartConfig(chartConfig, {
migrationProps: draft,
toVersion: "3.2.0",
});
chartConfigs.push(migratedChartConfig);
}

draft.chartConfigs = chartConfigs;
});
},
},
];

export const migrateConfiguratorState = makeMigrate<ConfiguratorState>(
Expand Down
Loading