From 8fd48bad4e28536ea001c321043ce5377af4a2ae Mon Sep 17 00:00:00 2001 From: Daria Abushenko <2009add@gmail.com> Date: Tue, 26 Nov 2024 14:18:55 +0500 Subject: [PATCH] =?UTF-8?q?fix(condo):=20DOMA-10735=20migration=20filled?= =?UTF-8?q?=20account=20number=20column=20for=20met=E2=80=A6=20(#5535)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(condo): DOMA-10735 migration filled account number column for meter readings * fix(condo): DOMA-10735 fixed condition * fix(condo): DOMA-10735 removed changes on down --- .../20241125100251-0439_auto_20241125_0702.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 apps/condo/migrations/20241125100251-0439_auto_20241125_0702.js diff --git a/apps/condo/migrations/20241125100251-0439_auto_20241125_0702.js b/apps/condo/migrations/20241125100251-0439_auto_20241125_0702.js new file mode 100644 index 00000000000..21dc80df27b --- /dev/null +++ b/apps/condo/migrations/20241125100251-0439_auto_20241125_0702.js @@ -0,0 +1,26 @@ +// auto generated by kmigrator +// KMIGRATOR:0439_auto_20241125_0702:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMi4xMyBvbiAyMDI0LTExLTI1IDA3OjAyCgpmcm9tIGRqYW5nby5kYiBpbXBvcnQgbWlncmF0aW9ucwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDQzOF9hdXRvXzIwMjQxMTEyXzExNTknKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgXQo= + +exports.up = async (knex) => { + await knex.raw(` + BEGIN; + SET statement_timeout = '1500s'; + + UPDATE "MeterReading" + SET "accountNumber" = "Meter"."accountNumber" + FROM "Meter" + WHERE "MeterReading"."meter" = "Meter"."id" + AND "Meter"."deletedAt" is NULL + AND "MeterReading"."accountNumber" is NULL; + + SET statement_timeout = '10s'; + COMMIT; + `) +} + +exports.down = async (knex) => { + await knex.raw(` + BEGIN; + COMMIT; + `) +} \ No newline at end of file