fix: move SET LOCAL inside transaction in quotation/media/comms migration scripts
This commit is contained in:
@@ -63,13 +63,12 @@ async def run() -> None:
|
||||
})
|
||||
|
||||
async with AsyncPgSession() as session:
|
||||
await session.execute(text("SET session_replication_role = replica"))
|
||||
async with session.begin():
|
||||
await session.execute(text("SET LOCAL session_replication_role = replica"))
|
||||
stmt = pg_insert(CrmCommsLog).values(records)
|
||||
stmt = stmt.on_conflict_do_nothing(index_elements=["id"])
|
||||
await session.execute(stmt)
|
||||
dest_count = await pg_count(session, "crm_comms_log")
|
||||
await session.execute(text("SET session_replication_role = DEFAULT"))
|
||||
|
||||
if dest_count < source_count:
|
||||
msg = f"Count mismatch: source={source_count} postgres={dest_count}"
|
||||
|
||||
Reference in New Issue
Block a user