Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database migration for #57 #60

Closed
kikuomax opened this issue Feb 23, 2020 · 0 comments · Fixed by #66
Closed

Database migration for #57 #60

kikuomax opened this issue Feb 23, 2020 · 0 comments · Fixed by #66
Assignees

Comments

@kikuomax
Copy link
Owner

kikuomax commented Feb 23, 2020

The database needs to have capability of expressing rows freely located (#57).

New pattern store

An entry in a new pattern store will look like

  • name: String
  • rows: Array< Object >
    • position: Object (new). Position of the row.
      • left: Number (new). Left position of the row.
      • top: Number (new). Top position of the row.
    • columns: Array< Object >
      • symbolId: String

keyPath is name.

See also #35.

@kikuomax kikuomax self-assigned this Feb 23, 2020
kikuomax added a commit that referenced this issue Mar 16, 2020
- A new `db` module that handles database is introduced.
  A new database version 2 is defined in `@db/version2`.
  The most primitive functionality `upgradePatternFromVersion1` that
  upgrades an object in a `pattern` store is tested.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- Database upgrade functions takes `IDBTransaction` instead of
  `IDBDatabase`. Because `IDBDtabase.transaction` is not allowed during
  a versionchange event; i.e., in `onupgradeneeded`. An `IDBTransaction`
  can be obtained from a return value of `indexedDB.open`.
- Database population and upgrade operations no longer return a Promise.
  Because a Promise is not handled so far.
- A population script `@db/version1.js` of the version 1 database is
  introduced.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- The database version is upgraded from 1 to 2.
- Error handling of `openRequest` is fixed. It does not resolve but
  rejects when an `error` or a `blocked` event is issued.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- The `$current` pattern is logged to debug the database upgrade
  functionality.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- The function that upgrades a pattern store version from 1 to 2 had a
  bug that a position of a row was not enclosed in a `position` object.
  It is not what described in the issues #60, so it is fixed.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- The workaround code that manages row positions in a separate variables
  is removed, because the database migration has completed.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- E2E tests set up a database for the test. So tests are now more
  reproducible. However some tests do not pass because the interface has
  been changed.

issue #60
kikuomax added a commit that referenced this issue Mar 16, 2020
- Cumbersome code to open and delete the AmidzDatabase is implemented as
  the follwong Cypress commands.
    - `openAmidzDatabase`
    - `deleteAmidzDatabase`

  They are defined in a new support file `amidz-database.js`.

issue #60
@kikuomax kikuomax mentioned this issue Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant