DanF1
September 2, 2025, 4:38pm
1
I am running on Windows 11, with Wappler 7.2.1
I created a SQLite database with multiple tables. I need to change some of the field properties.
When I click on Apply Database Changes I get this error:
Error: alter table ‘Benches add column “fkpnIdBenches” integer - SQLITE_ERROR: duplicate column name: fkpnIdBenches.
It is treating it as if it is a new column rather than modifying a column.
Are you trying to change a primary key's name?
If so Wappler doesnt allow that.
DanF1
September 3, 2025, 1:22pm
3
No, fkpnIdBenches is the second field and a foreign key, and I am not making any changes to it. I am modifying other fields in the database.
SQL used to export the database
exports.up = function(knex) {
return knex.schema
.table('Benches', async function (table) {
table.integer('fkPnIdBenches').defaultTo(NULL).alter();
table.integer('fkOwnerIdBenches').defaultTo(NULL).alter();
table.boolean('active').defaultTo(1).alter();
table.integer('sizeBench').defaultTo(NULL).comment('length in inches').alter();
table.string('benchMaterial', 50).defaultTo(NULL).alter();
table.float('benchCost').defaultTo(Null).alter();
table.text('benchSource').defaultTo(NULL).comment('Name of manufacturer').alter();
table.text('benchPic').defaultTo(NULL).comment('Picture of the bench').alter();
table.date('benchStartDate ').defaultTo(knex.fn.now()).comment('Date file was created').alter();
table.date('benchEndDate').defaultTo(NULL).comment('Date bench is retired').alter();
})
};
exports.down = function(knex) {
return knex.schema
.table('Benches', async function (table) {
table.integer('fkPnIdBenches').defaultTo().alter();
table.integer('fkOwnerIdBenches').defaultTo().alter();
table.boolean('active').defaultTo().alter();
table.integer('sizeBench').defaultTo().comment('').alter();
table.string('benchMaterial', 50).defaultTo().alter();
table.float('benchCost').defaultTo().alter();
table.text('benchSource').defaultTo().comment('').alter();
table.text('benchPic').defaultTo().comment('').alter();
table.text('benchStartDate ').defaultTo().comment('').alter();
table.text('benchEndDate').defaultTo().comment('').alter();
})
I hope that this is helpful
Dan
DanF1
September 3, 2025, 6:32pm
4
I just removed the table and started over. The issue did not appear, so all is good.