Create database cleanup logic