Skip to content

Commit

Permalink
fix onConflict error
Browse files Browse the repository at this point in the history
  • Loading branch information
tshedor committed Aug 27, 2024
1 parent bb2437c commit b6d2f04
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SupabaseDefinedAdapter extends OfflineFirstAdapter<SupabaseDefined> {
@override
final ignoreDuplicates = false;
@override
final onConflict = user_id, other_id;
final onConflict = 'user_id, other_id';
@override
final uniqueFields = {};
@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class SupabaseSerializable {
/// Defaults to `FieldRename.snake` case.
final FieldRename fieldRename;

/// Forwards to Supabase's ignoreDuplicates parameter.
/// Forwards to Supabase's `ignoreDuplicates` parameter.
final bool ignoreDuplicates;

/// Forwards to Supabase's onConflict parameter.
/// Forwards to Supabase's `onConflict` parameter.
/// This should be comma-separated Supabase column names, not Dart fields.
final String? onConflict;

/// The Supabase table name to fetch from. For example, `"users"`
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_supabase/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_supabase
issue_tracker: https://github.com/GetDutchie/brick/issues
repository: https://github.com/GetDutchie/brick

version: 0.1.1
version: 0.1.1+1

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class SupabaseSerialize extends SupabaseSerdesGenerator
'@override\nfinal defaultToNull = ${config?.defaultToNull};',
'@override\nfinal fieldsToSupabaseColumns = {${fieldsToColumns.join(',\n')}};',
'@override\nfinal ignoreDuplicates = ${config?.ignoreDuplicates};',
if (config?.onConflict != null) '@override\nfinal onConflict = ${config?.onConflict};',
if (config?.onConflict != null)
'@override\nfinal onConflict = ${config?.onConflict == null ? 'null' : "'${config?.onConflict}'"};',
'@override\nfinal uniqueFields = {${uniqueFields.map((u) => "'$u'").join(',\n')}};',
];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_supabase_generators/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_supabase_
issue_tracker: https://github.com/GetDutchie/brick/issues
repository: https://github.com/GetDutchie/brick

version: 0.1.1
version: 0.1.1+1

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down

0 comments on commit b6d2f04

Please sign in to comment.