Wappler 7.3.6
Electron
SQLite
I'm having some issues and trying to understand what's going on when change some values on db:
Here are the steps that I make:
-
Create a db and set some int value
-
You can check the table with this code:
(async () => {
const { CapacitorSQLite } = Capacitor.Plugins;
const dbName = 'maindb'; // Change db name here
await CapacitorSQLite.createConnection({
database: dbName, version: 999, encrypted: false, mode: 'no-encryption', readonly: false
});
await CapacitorSQLite.open({ database: dbName, readonly: false });
const ver = await CapacitorSQLite.query({ database: dbName, statement: 'PRAGMA user_version;' });
console.log('DB user_version:', ver.values[0]);
const schema = await CapacitorSQLite.query({ database: dbName, statement: 'SELECT name, sql FROM sqlite_master WHERE type="table";' });
console.table(schema.values);
await CapacitorSQLite.closeConnection({ database: dbName });
})();
-
The schema is defined as:

-
On change, save and update:
This is what I have on \www\js\connections\testing.js:
dmx.databases = dmx.databases || {};
dmx.databases['testing'] = {
"version": 2,
"upgrade": [
{
"toVersion": 1,
"statements": [
"create table `values` (`id` integer not null primary key autoincrement, `value` integer)"
]
},
{
"toVersion": 2,
"statements": [
"PRAGMA table_info(`values`)"
]
}
]
}
This on migrations:
.wappler\migrations\testing\20251009185638_a.js:
exports.up = function(knex) {
return knex.schema
.createTable('values', async function (table) {
table.increments('id');
table.integer('value');
})
};
exports.down = function(knex) {
return knex.schema
.dropTable('values')
};
.wappler\migrations\testing\20251009200743_var1.js:
exports.up = function(knex) {
return knex.schema
.table('values', async function (table) {
table.text('value').alter();
})
};
exports.down = function(knex) {
return knex.schema
.table('values', async function (table) {
table.integer('value').alter();
})
};
Maybe an alter table is missing on testingdb.json?
PS, also opening database outside Wappler (generated one on capacitor user\capacitor databases)
I can see:
While the original on root folder:
So I'm confused here, I'm doing something wrong?
Thanks




