Skip to content
Back

Strange behavior while using transactions.

  • 0
  • Flutter
  • Cloud
Ateyib
9 Nov, 2025, 07:05

I am trying to use transaction to create rows in multiple tables and update another table relationship column. but when I commit the transaction, I get The transaction has a conflict error. the strange thing is, out of the 4 tables that needed to be updated, only one got updated but it confused the column values. It updated the $createdAt and $updatedAt columns with relationship values and it updated the two custom columns with date values. I am using the dark sdk for experimenting. I have included a screenshot. ```Dart Future<void> createFamily() async { final ateyibUserId = 'userId';

var tablesDb = TablesDB(client); var userSecureInfoRow = await tablesDb.getRow( databaseId: databaseId, tableId: 'usersecurityinfo', rowId: ateyibUserId, );

final transaction = await tablesDb.createTransaction();

final tid = transaction.$id;

// create family final familyId = ID.unique(); final result = await tablesDb.createRow( databaseId: databaseId, rowId: familyId, tableId: 'family', data: { 'name': 'The Ates', 'creator': ateyibUserId, 'memberships': [ {'role': 'admin', 'user': ateyibUserId, 'familyId': familyId}, ], }, transactionId: tid, );

// create familyKey final familyKeyId = ID.unique(); final family = await tablesDb.createRow( databaseId: databaseId, tableId: 'familyKey', rowId: familyKeyId, data: {'userId': ateyibUserId, 'familyId': familyId, 'key': 'familyKey'}, transactionId: tid, );

// update user secure info final secureInfoRows = await tablesDb.updateRow( databaseId: databaseId, tableId: 'usersecurityinfo', rowId: ateyibUserId, data: { 'families': [...familyIds, familyId], 'familyKeys': [...familyKeyIds, familyKeyId], }, transactionId: tid, );

// Commit await tablesDb.updateTransaction( transactionId: tid, commit: true, ); }```

TL;DR
Developers are experiencing issues with transactions and table updates in their code using the Dark SDK. After attempting to create rows and update a relationship column in multiple tables within a transaction, only one table got updated with incorrect column values. The error message received is 'The transaction has a conflict.' Developers need to troubleshoot and possibly modify their transaction handling and row updates to resolve this issue.
Ateyib
9 Nov, 2025, 07:11

In the usersecurityinfo table, the families and familyKyes columns are relationship columns

Ateyib
9 Nov, 2025, 07:19
Ateyib
9 Nov, 2025, 07:38

another strange thing is when i fetch the usersecurityinfo table, I get the correct data other that the relationship columns are null.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more