I’m currently trying to make multiple tables in SQLITE in my ionic project, but it appears that this format is not working; does anyone have any ideas on how to create multiple tables in SQLITE in an ionic project? thank you very much
databaseConn() {
this.platform.ready().then(() => {
this.sqlite.create({
name: this.db_name,
location: 'default'
}).then((sqLite: SQLiteObject) => {
this.dbInstance = sqLite;
this.createTable(
`CREATE TABLE IF NOT EXISTS ${this.db_table} (
product_id INTEGER PRIMARY KEY,
product_name varchar(255),
product_price varchar(255)
)`
);
this.createTable(
`CREATE TABLE IF NOT EXISTS ${this.db_table2} (
customer_id INTEGER PRIMARY KEY,
customer_name varchar(255)
)`
);
})
.catch((error) => alert(JSON.stringify(error)));
});
}
createTable(tableStr: string): void {
this.dbInstance.executeSql(`${tableStr}`, []).then((res) => {
console.log('table was created')
})
.catch(e => {
alert("error " + JSON.stringify(e))
})
}