Skip to content

Commit

Permalink
db [nfc]: Remove handwritten copy of copyWithCompanion
Browse files Browse the repository at this point in the history
This has been addressed in Greg's upstream PR:
  simolus3/drift#3022

which was pulled in by the Drift upgrade in 8b564e4 (#1117).

Signed-off-by: Zixuan James Li <[email protected]>
  • Loading branch information
PIG208 authored and gnprice committed Dec 19, 2024
1 parent 0edabbf commit 59c6ef6
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions lib/model/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,13 @@ class Accounts extends Table {

Column<String> get ackedPushToken => text().nullable()();

// If adding a column, be sure to add it to copyWithCompanion too.

@override
List<Set<Column<Object>>> get uniqueKeys => [
{realmUrl, userId},
{realmUrl, email},
];
}

extension AccountExtension on Account {
Account copyWithCompanion(AccountsCompanion data) { // TODO(drift): generate this
return Account(
id: data.id.present ? data.id.value : id,
realmUrl: data.realmUrl.present ? data.realmUrl.value : realmUrl,
userId: data.userId.present ? data.userId.value : userId,
email: data.email.present ? data.email.value : email,
apiKey: data.apiKey.present ? data.apiKey.value : apiKey,
zulipVersion: data.zulipVersion.present ? data.zulipVersion.value : zulipVersion,
zulipMergeBase: data.zulipMergeBase.present ? data.zulipMergeBase.value : zulipMergeBase,
zulipFeatureLevel: data.zulipFeatureLevel.present ? data.zulipFeatureLevel.value : zulipFeatureLevel,
ackedPushToken: data.ackedPushToken.present ? data.ackedPushToken.value : ackedPushToken,
);
}
}

class UriConverter extends TypeConverter<Uri, String> {
const UriConverter();
@override String toSql(Uri value) => value.toString();
Expand Down

0 comments on commit 59c6ef6

Please sign in to comment.