ujjwalguptaofficial / JsStore

Simplifying IndexedDB with SQL like syntax and promises
http://jsstore.net/
MIT License
858 stars 110 forks source link

how to add a new table? #318

Closed ujjwalguptaofficial closed 1 year ago

ujjwalguptaofficial commented 1 year ago

Discussed in https://github.com/ujjwalguptaofficial/JsStore/discussions/317

Originally posted by **wyknmjj** March 22, 2023 I added a new table in initDB and increased the version number by 1. The table was successfully created, but I couldn't add any data to it, and reported a ```js { "message": "Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path yielded a value that is not a valid key.", "type": "DataError" } ``` error. Or I changed the table I added in initDB to alter, the table can be successfully created, but the generated table structure is different from the initialized structure. ![image](https://user-images.githubusercontent.com/92901171/226890698-77674629-6510-4d6c-91a4-c22c18b77004.png) The code in alter mode is like this ```js { name: tableChatName, columns: { }, alter: { 2: { drop: { }, modify: { id: { primaryKey: true, autoIncrement: true }, content: { notNull: true, dataType: DATA_TYPE.String }, createTime: { notNull: true, dataType: DATA_TYPE.DateTime } }, add: { } } } } ```
ujjwalguptaofficial commented 1 year ago

fixed in v - 4.5.3