Does anyone know how to set up indexes for mobile projects that are using SQLite?
I tried creating an additional knex js file under .wappler > migrations in hopes that it would be used during the build of the electron app, but it didn't appear to have any effect.
Here's the code I put in the file.
exports.up = function(knex) {
return knex.schema.alterTable('Email', function(table) {
// Add a single-column index for GmailThreadId
table.index('GmailThreadId', 'idx_email_gmailthreadid');
// Add a composite index for GmailThreadId and GmailInternalDate
table.index(['GmailThreadId', knex.raw('GmailInternalDate DESC')], 'idx_email_threadid_date_desc');
});
};
exports.down = function(knex) {
return knex.schema.alterTable('Email', function(table) {
// Drop the single-column index
table.dropIndex('GmailThreadId', 'idx_email_gmailthreadid');
// Drop the composite index
table.dropIndex(['GmailThreadId', knex.raw('GmailInternalDate DESC')], 'idx_email_threadid_date_desc');
});
};
I created a custom knex migration file and for whatever reason it doesn't appear to get applied. I don't think there's a difference in Wappler's knex intergration between mobile and web projects.
Seems like I need to modify one of the Wappler created migration files since there isn't a built in way to generate the record in the wappler_migrations table.
As far as I know, the row is created in wappler_migrations table the first time you run the migration - it's not the source of migration listing. I could be wrong though so I don't bet on it.
Do you confirm you've restarted Wappler and hit whatever refresh button you found?
Yes indeed this is currently needed because the changes are executed directly so you can’t edit them first.
I’ll see if we can add option for manual migration file creation or maybe add an option on save changes to execute them or not directly ( so you can edit them first.
Furthermore changes are just regular Knex migration files, so you can do all things in them as described on the Knex docs