I’m in the process of updating an application built a few years ago with cordova.
I Updated ionic-native dependency to @awesome-cordova-plugins
but when the database goes to perform its functions, they are not working.
import { Injectable } from '@angular/core';
import { SQLite, SQLiteObject } from '@awesome-cordova-plugins/sqlite/ngx';
@Injectable({
providedIn: 'root'
})
export class DatabaseService {
db!: SQLiteObject;
constructor(
private sqlite: SQLite
) { }
/****************************
** Cria a estrutura inicial do banco de dados
****************************/
createDatabase() {
return this.getDB().then((db: SQLiteObject) => {
this.db = db;
this.createTables();
});
}
/*****************************
** Cria um banco se não existir senão pega um banco existente com o nome no parametro
*****************************/
private getDB() {
return this.sqlite.create({
name: 'producao.db',
location: 'default',
});
}
ERROR TypeError: Cannot read properties of undefined (reading 'executeSql')