Init order. Sqlite plugin. Execution order

Hello. This is driving me nuts.

I have this init code:

mediaApp.run(function ( $ionicPlatform,
                        $cordovaSQLite,
                        $location,
                        $rootScope,
                        databaseService) {
    $ionicPlatform.ready(function () {

        databaseService.initDB($cordovaSQLite);

         if(window.cordova && window.cordova.plugins.Keyboard) {
             cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
             cordova.plugins.Keyboard.disableScroll(true);
         }
         
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }

      $location.path('/menu/catalog');
      $rootScope.$apply();

    });
});

The databaseService.initDB opens and populates the sqlite database.
Somehow the consolelogs inside initDB ends up execution after the ready method ended.
Render of the first view (menu/catalog) is wrong beacuse the database is not populated yet.
Is there a workaround for this? I just want ionic/sqlite plugin to execute in the order i wrote the sentences…
Is sqlite running on another thread?

Thanks in advance