Destroy order if import via api raises any error

So that no unintentionally partial order remains in the database

Fixes #3789
[api] Fix postgresql-specific error in Variants tests

The problem was we were passing a number to PostgreSQL for a string field (the permalink field). PostgreSQL spat the dummy because it doesn't know how to translate between strings and integers.