Make the metadata import process retryable and idempotent
Context
In !136 (merged) we have introduced a tool to import metadata from a registry filesystem into a database.
Problem
The import tool is currently not idempotent and therefore does not allow for retries in case of a failure. Although most of the code is ready to reuse existing artifacts in the database, the tool starts by validating that the target database is empty and if not halts the execution.
Solution
The import tool should be idempotent, allowing users to retry an import in case of an error. The tool should handle existing artifacts gracefully.