Path and category as primary keys
Insert or ignore new records
Create tables if not exists in some funcs
refs #542