From 2bbb5e714764d53600872be98bc6648861f079da Mon Sep 17 00:00:00 2001 From: Toni Sharpe Date: Thu, 25 Jul 2024 22:42:23 +0200 Subject: [PATCH] fix 1444 PR comment * mistake made with schema update, a new migration should be added, not current ones renamed * the `down` portion reverts this value to schema 004 --- ...710002-UpdateSchemaForChartConfigChange.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 db/migration/1721137710002-UpdateSchemaForChartConfigChange.ts diff --git a/db/migration/1721137710002-UpdateSchemaForChartConfigChange.ts b/db/migration/1721137710002-UpdateSchemaForChartConfigChange.ts new file mode 100644 index 00000000000..a9cc8e855ec --- /dev/null +++ b/db/migration/1721137710002-UpdateSchemaForChartConfigChange.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from "typeorm" + +export class UpdateSchemaForChartConfigChange + 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'); + `) + } +}