diff --git a/package.json b/package.json index 23c9035d..f55d2f91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsstore", - "version": "4.3.2", + "version": "4.3.3", "description": "A complete IndexedDB wrapper with SQL like syntax.", "main": "dist/npm.export.js", "types": "dist/ts/main/index.d.ts", diff --git a/src/worker/idbutil/index.ts b/src/worker/idbutil/index.ts index fc67ccc6..0952be62 100644 --- a/src/worker/idbutil/index.ts +++ b/src/worker/idbutil/index.ts @@ -120,8 +120,8 @@ export class IDBUtil { }); } const addColumn = (store: IDBObjectStore, column: IColumn) => { - if (column.enableSearch) { - const columnName = column.name; + const columnName = column.name; + if (column.enableSearch && !store.indexNames.contains(columnName)) { const options = column.primaryKey ? { unique: true } : { unique: column.unique }; options['multiEntry'] = column.multiEntry; const keyPath = column.keyPath == null ? columnName : column.keyPath; diff --git a/test/cases/db_upgrade.js b/test/cases/db_upgrade.js index 319cc559..89f9c7fc 100644 --- a/test/cases/db_upgrade.js +++ b/test/cases/db_upgrade.js @@ -402,7 +402,13 @@ describe('Db upgrade Test', function () { add: { name: { dataType: 'string' - } + }, + "id": { + "primaryKey": true, + "dataType": "number", + "autoIncrement": true, + "notNull": true + }, }, }, 5: {