Sqlite adapter: Fix unique indexes and add unit test