fix(datastore): use "safe find or create" instead of "create or find" for namespaces
Please see #483 (closed) for context and an explanation of the problem.
This MR implements the solution described in the linked issue for the top_level_namespaces
entity. If approved, we can then replicate this for the repositories
entity as well.
Using the change from this MR and repeating the docker tag/push
test explained in the linked issue, we now see the following on the database:
localhost postgres@registry=# select * from top_level_namespaces;
id | created_at | updated_at | name
----+-------------------------------+------------+------
1 | 2021-11-08 14:31:42.945236+00 | [NULL] | ns1
2 | 2021-11-08 14:32:15.797725+00 | [NULL] | ns2
3 | 2021-11-08 14:32:18.713151+00 | [NULL] | ns3