refactor the database: modify table favorites and add table apps.

refactor the database: modify table favorites and add table apps.