Use a transaction when creating an artifact.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
I could just use a transaction for the inner part -- queries that get executed when a formation of the same name already exists (but is deleted).