Skip to content

Commit

Permalink
🐛 (grapher) delete stackMode=null from chart configs
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Sep 5, 2024
1 parent 0a61d87 commit 5037f76
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions db/migration/1725540224795-CleanUpChartConfigStackMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class CleanUpChartConfigStackMode1725540224795
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`-- sql
UPDATE chart_configs cc
JOIN charts c ON c.configId = cc.id
SET
-- remove NULLs from the patch config
cc.patch = JSON_REMOVE(cc.patch, '$.stackMode'),
-- replace NULLs with the default value in the full config
cc.full = JSON_REPLACE(cc.full, '$.stackMode', 'absolute')
WHERE cc.patch ->> '$.stackMode' = 'null'
`)
}

// eslint-disable-next-line
public async down(queryRunner: QueryRunner): Promise<void> {}
}
4 changes: 2 additions & 2 deletions devTools/schemaProcessor/columns.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,10 @@
"editor": "checkbox"
},
{
"type": ["string", "null"],
"type": "string",
"pointer": "/stackMode",
"editor": "textfield",
"enumOptions": ["absolute", "relative", "grouped", "stacked", null]
"enumOptions": ["absolute", "relative"]
},
{
"type": ["string", "number"],
Expand Down

0 comments on commit 5037f76

Please sign in to comment.