Migrate tables to database