Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
UPDATE "bookings_bookingaccount"
SET "email" = NULL,
"address_line1" = %s,
"address_line2" = %s,
"address_city" = %s,
"address_county" = %s,
"address_country" = NULL,
"address_post_code" = %s,
"phone_number" = %s,
"share_phone_number" = %s,
"email_communication" = %s,
"subscribe_to_mailings" = NULL,
"subscribe_to_newsletter" = %s,
"erased_on" = (CASE
WHEN erased_on IS NULL THEN %s
ELSE erased_on
WHERE "bookings_bookingaccount"."id" IN
(SELECT V0."id"
FROM "bookings_bookingaccount" V0
LEFT OUTER JOIN "bookings_booking" V1 ON (V0."id" = V1."account_id")
LEFT OUTER JOIN "bookings_payment" V2 ON (V0."id" = V2."account_id")
LEFT OUTER JOIN "cciwmain_camp" V3 ON (V1."camp_id" = V3."id")
WHERE (NOT (V0."id" IN
(SELECT U0."account_id"
FROM "bookings_booking" U0
INNER JOIN "cciwmain_camp" U1 ON (U0."camp_id" = U1."id")
WHERE U1."end_date" >= %s))
WHEN bookings_bookingaccount.last_login IS NOT NULL THEN bookings_bookingaccount.last_login
ELSE bookings_bookingaccount.created_at
END) < %s))
GROUP BY V0."id"
WHERE NOT (V1."state" IN (%s, %s)
AND V1."state" IS NOT NULL)), %s) = (V0."total_received")
AND (MAX(V2."created_at") IS NULL
OR MAX(V2."created_at") < %s)
AND (MAX(V3."end_date") IS NULL
OR MAX(V3."end_date") < %s)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment