image method

Future<void> image(
  1. Session session,
  2. UserProfile userProfile, {
  3. Transaction? transaction,
})

Detaches the relation between this UserProfile and the UserProfileImage set in image by setting the UserProfile's foreign key imageId to null.

This removes the association between the two models without deleting the related record.

Implementation

Future<void> image(
  _i1.Session session,
  UserProfile userProfile, {
  _i1.Transaction? transaction,
}) async {
  if (userProfile.id == null) {
    throw ArgumentError.notNull('userProfile.id');
  }

  var $userProfile = userProfile.copyWith(imageId: null);
  await session.db.updateRow<UserProfile>(
    $userProfile,
    columns: [UserProfile.t.imageId],
    transaction: transaction,
  );
}