Trying to use existing SQLite DB in new Ionic project


I’m very new to Ionic and Angular so please forgive my noob question, but i’m trying to just open an SQLite database that i already have from my existing iOS and Android apps that i’ve written natively (now looking to use just 1 code base)
In my existing apps, i check to see if the DB exists and if it does i’ll just use that, if it doesn’t then i can download an updated version (if required) or copy it from the app bundle.
In Ionic it seems that i have to create a DB and import everything into it from my existing DB - Thats fine i can do that to, but when i next launch the app it copies everything back into the new DB instead of just using the existing data.

Can anyone shed any light on how i can do this. I’ve also tried to change the loaction of the new DB but i seem to only be able to use ‘deafult’…

My code is below & i’m only testing on an actual device (no web browser)
Any suggestions or pointers would be great!!
Thank you.

import { Platform } from '@ionic/angular';
import { Injectable } from '@angular/core';
import { SQLitePorter } from '@ionic-native/sqlite-porter/ngx';
import { HttpClient } from '@angular/common/http';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
import { BehaviorSubject, Observable } from 'rxjs';
import { File } from '@ionic-native/file/ngx';
import { LoadingController } from '@ionic/angular';

export interface Dev {
  id: number,
  name: string,
  fav: string

  providedIn: 'root'

export class DatabaseService {
  private database: SQLiteObject;
  private dbReady: BehaviorSubject<boolean> = new BehaviorSubject(false);
  readonly database_name: string = 'developers23.db';

  developers = new BehaviorSubject([]);
  products = new BehaviorSubject([]);
    private platform: Platform, 
    private sqlitePorter: SQLitePorter, 
    private sqlite: SQLite, 
    private http: HttpClient,
    private file: File,
    public loadingController: LoadingController
    ) {
    this.platform.ready().then(() => {
      console.log('Platform Ready!');
      // this.createDB();
    }).catch(error => {

  checkDBExists() {
    this.file.checkFile('default', 'developers23.db')
  createDB() {
    console.log('DB Create1');
      name: this.database_name,
      location: 'default'
      .then((db: SQLiteObject) => {
        this.database = db;
      .catch(e => {
        alert("error " + JSON.stringify(e))

  seedDatabase() {
    console.log('Seed database');
    this.http.get('assets/seed3.sql', { responseType: 'text'})
    .subscribe(sql => {
      console.log('DB Create');
      this.sqlitePorter.importSqlToDb(this.database, sql)
        .then(_ => {
          console.log('DB Create - then');
        .catch(e => console.error(e));
  getDatabaseState() {
    return this.dbReady.asObservable();
  getDevs(): Observable<Dev[]> {
    return this.developers.asObservable();

  loadDevelopers() {
    console.log('Getting Manufacturers');
    return this.database.executeSql('SELECT * FROM Lighting_Manufacturers Order By Title COLLATE NOCASE', []).then(data => {
      let developers: Dev[] = [];
      console.log('Getting Manufacturers');
      if (data.rows.length > 0) {
        for (var i = 0; i < data.rows.length; i++) {
            id: data.rows.item(i)._id,
            name: data.rows.item(i).Title,  
            fav: data.rows.item(i).fav