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