I actually hit an interesting case:
Do you really want to execute the archive import? Note: this is irreversible! [y/N]: y
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."username" = $1 LIMIT $2 [["username", "teest"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "flaburgan@XXXX"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."username" = $1 LIMIT $2 [["username", "teest"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE (id != NULL AND email = NULL) LIMIT $1 [["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: Person Exists (0.3ms) SELECT 1 AS one FROM "people" WHERE "people"."diaspora_handle" = $1 LIMIT $2 [["diaspora_handle", "teest@localhost:3000"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: (0.1ms) BEGIN
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "flaburgan@XXXX"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."username" = $1 LIMIT $2 [["username", "teest"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE (id != NULL AND email = NULL) LIMIT $1 [["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: Person Exists (0.2ms) SELECT 1 AS one FROM "people" WHERE "people"."diaspora_handle" = $1 LIMIT $2 [["diaspora_handle", "teest@localhost:3000"], ["LIMIT", 1]]
[2021-09-08T21:19:53] DEBUG PID-17442 TID-62280 ActiveRecord::Base: (0.2ms) ROLLBACK
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Email is already taken., Person can't be blank
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/validations.rb:80:in `raise_validation_error'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/validations.rb:52:in `save!'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:315:in `block in save!'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `synchronize'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212:in `transaction'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:315:in `save!'
/var/lib/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/suppressor.rb:48:in `save!'
/home/fla/diaspora/diaspora/lib/archive_importer.rb:40:in `create_user'
/home/fla/diaspora/diaspora/app/services/migration_service.rb:51:in `find_or_create_user'
/home/fla/diaspora/diaspora/app/services/migration_service.rb:22:in `perform!'
/home/fla/diaspora/diaspora/lib/tasks/accounts.rake:22:in `block (2 levels) in <top (required)>'
Tasks: TOP => accounts:migration
(See full trace by running task with --trace)
So if another user that the one who is imported as the same e-mail than in the archive, the import fails. Is that what we want? I could imagine a valid case where a user has two accounts in a pod, wants to merge a third one in one account, but the email in the archive is the same than the email of the second account. I know, few chances that this would happen but ?