ujjwalguptaofficial / JsStore

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

Do not force to write add, drop, and modify when altering a table #321

Closed josebailo closed 1 year ago

josebailo commented 1 year ago

Summary

When using Typescript, the interface IAlterQuery force you to set add, drop, and modify properties when altering a table even if you don't need them. I think would be a good idea make them optionally.

Basic example

Alter the interface from this:

export interface IAlterQuery {
  [version: number]: {
    add: TColumns;
    drop: TColumns;
    modify: TColumns;
  };
}

To this:

export interface IAlterQuery {
  [version: number]: {
    add?: TColumns;
    drop?: TColumns;
    modify?: TColumns;
  };
}

Motivation

This way you could write an alter with just the things you need to add.

ujjwalguptaofficial commented 1 year ago

Ok gotcha. It would be great if you can rise a PR - you have already figured out what to do :). I will just copy paste your code lol :rofl:

ujjwalguptaofficial commented 1 year ago

fixed in v - 4.5.6