This method is used to initialize the database.
It first gets the application documents directory and then constructs the path of the database file.
It then opens the database and creates the tables if they do not exist.
It also handles the database upgrade process.