diff --git a/db/migration/1725540224800-RemoveHideLinesOutsideToleranceFromConfig.ts b/db/migration/1725540224800-RemoveHideLinesOutsideToleranceFromConfig.ts index c32d7ca5988..bc95358f8c1 100644 --- a/db/migration/1725540224800-RemoveHideLinesOutsideToleranceFromConfig.ts +++ b/db/migration/1725540224800-RemoveHideLinesOutsideToleranceFromConfig.ts @@ -3,12 +3,20 @@ import { MigrationInterface, QueryRunner } from "typeorm" export class RemoveHideLinesOutsideToleranceFromConfig1725540224800 implements MigrationInterface { + private remove_hide_lines_outside_tolerance(field: string) { + return `${field} = JSON_REMOVE( + ${field}, + '$."hideLinesOutsideTolerance"' + )` + } + public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(`-- sql - UPDATE charts - SET config = JSON_REMOVE(config, '$."hideLinesOutsideTolerance"') - WHERE - type = "ScatterPlot" + UPDATE + chart_configs + SET + ${this.remove_hide_lines_outside_tolerance('full')}, + ${this.remove_hide_lines_outside_tolerance('patch')} `) } diff --git a/db/migration/1725540224801-UpdateSchemaForChartConfigChange.ts b/db/migration/1725540224801-UpdateSchemaForChartConfigChange.ts deleted file mode 100644 index b968d271422..00000000000 --- a/db/migration/1725540224801-UpdateSchemaForChartConfigChange.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm" - -export class UpdateSchemaForChartConfigChange1725540224801 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`-- sql - UPDATE charts - SET config = JSON_SET(config, '$.$schema', 'https://files.ourworldindata.org/schemas/grapher-schema.005.json'); - `) - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`-- sql - UPDATE charts - SET config = JSON_SET(config, '$.$schema', 'https://files.ourworldindata.org/schemas/grapher-schema.004.json'); - `) - } -}