Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1081 from joyent/ether/fix-copy_user_data
Browse files Browse the repository at this point in the history
skip users with a duplicate email address that were created since the dbs diverged
  • Loading branch information
karenetheridge committed Jan 7, 2021
2 parents 23c8316 + 28576c3 commit ea7abdf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Conch/Command/copy_user_data.pm
Expand Up @@ -69,7 +69,7 @@ sub run ($self, @opts) {
},
), $opt->from, $opt->to;

my $from_user_rs = $from_schema->resultset('user_account')->hri;
my $from_user_rs = $from_schema->resultset('user_account')->active->hri;
my $to_user_rs = $to_schema->resultset('user_account');

if ($opt->dry_run) {
Expand All @@ -86,6 +86,8 @@ sub run ($self, @opts) {
++$updated;
}
else {
next if $to_user_rs->search(\[ 'lower(email) = lower(?)', $user_data->{email} ]);

my $row = $to_user_rs->new_result({});
# we do not use set_columns, because DBIx::Class::PassphraseColumn
# inappropriately wraps it to encrypt the data.
Expand Down

0 comments on commit ea7abdf

Please sign in to comment.