You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
715 B

import init_queries from "./db";
/* createAllTables(db)
*
* Creates all tables from `db.js` file into
* db arg.
*/
function createAllTables(db) {
db.transaction((tx) => {
init_queries.forEach((query) => {
tx.executeSql(
query,
[],
(_, { rows: { _array } }) => {
console.debug("Table created successfully");
},
(_, err) => {
console.debug("Error while creating table: " + JSON.stringify(err));
}
);
});
});
}
/* initDatabase(db)
*
* Initiate database with tables and forms from FeedScreens
*
*/
function initDatabase(db) {
(db != undefined && db !== null) && createAllTables(db);
}
export default initDatabase;