enforce unique keys ticket #165