The directory column in the table should have UNIQUE on it too if you create a unique index.