Skip to content

Commit

Permalink
feat(brick_supabase): add onConflict when upsert supabase (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonbs21 authored Oct 18, 2024
1 parent a34494d commit 191bcf6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/brick_supabase/lib/src/supabase_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class SupabaseProvider implements Provider<SupabaseModel> {
QuerySupabaseTransformer(adapter: adapter, modelDictionary: modelDictionary, query: query);

final builder = adapter.uniqueFields.fold(
client.from(adapter.supabaseTableName).upsert(serializedInstance), (acc, uniqueFieldName) {
client
.from(adapter.supabaseTableName)
.upsert(serializedInstance, onConflict: adapter.onConflict), (acc, uniqueFieldName) {
final columnName = adapter.fieldsToSupabaseColumns[uniqueFieldName]!.columnName;
if (serializedInstance.containsKey(columnName)) {
return acc.eq(columnName, serializedInstance[columnName]);
Expand Down

0 comments on commit 191bcf6

Please sign in to comment.