ToolJet/server/data-migrations/1773225075273-updatepgsqlssltoggletoboolean.ts
Ganesh Kumar 0a7915470c
Fix : SSL toggle conversion to boolean (#15529)
* hotfix for converting ssl toggle to boolean

* ssl toggle autofill fix for pgsql

* Fix for enable save button for pgsql

* removed validation for SSH

---------

Co-authored-by: Siddharthpl <siddharthpundir73@gmail.com>
2026-03-12 12:08:33 +05:30

28 lines
1.1 KiB
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class Updatepgsqlssltoggletoboolean1773225075273 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE data_source_options dso
SET "options" = (
"options"::jsonb
|| jsonb_build_object(
'ssl_enabled',
CASE
WHEN ("options"::jsonb -> 'ssl_enabled' ->> 'value') = 'enabled'
THEN jsonb_build_object('value', true, 'encrypted', false)
WHEN ("options"::jsonb -> 'ssl_enabled' ->> 'value') = 'disabled'
THEN jsonb_build_object('value', false, 'encrypted', false)
ELSE ("options"::jsonb -> 'ssl_enabled')
END
)
)::json
FROM data_sources ds
WHERE ds.id = dso.data_source_id
AND ds.kind = 'postgresql'
AND ("options"::jsonb -> 'ssl_enabled' ->> 'value') IN ('enabled', 'disabled');
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {}
}