Delete data from sqlite table is not working properly

I have created an ionic app using SQLite for offline storage. My app is work as when the user logged in a database is created for the user and after log out database is cleared. Problem is that when I log in and log out and again login then the previous entries are present in the database. If I remove the app from the background and then log in it works fine. I have created a service for the database to create and remove entries. And also I have created one more service for data sync from the server. In the process of login then log out then login back I have an issue in data sync service. I am finding some older entries. I have tried many things like dropping the entire database and recreate, Dropping all the tables and recreate them and delete all the data of the table but nothing is working for the above process. if I drop the entire database and recreate then the error is “No such table” in the sync service otherwise I found some older entries in the database table. It might be some SQLite instance issue. I am using ionic 4. If someone knows the answer then please help me.