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 Support #12

Merged
merged 6 commits into from
Nov 3, 2021
Merged

Database Support #12

merged 6 commits into from
Nov 3, 2021

Conversation

Karna98
Copy link
Owner

@Karna98 Karna98 commented Nov 2, 2021

Description

Added support of better-sqlite3 database.

Additional Context

  • Downgrade Electron from ^14.0.0 to ^13.0.0.
    Refer to discussions and related links to issues mentioned in the discussion.
    In future, once the electron-rebuild fixes the different node version issues while compiling, we will upgrade the Electron version.
  • PR contains a simple demonstration of integrating the database and performing a basic insert query and retrieving data queries from the database.
  • PR also demonstrates how to handle database migrations.

Testing Database and Migration

  1. Inside the Notes folder, run npm install to install all the dependencies.
  2. Then run npm run native-dep. This will install better-sqlite3 and compile based on local OS.
  3. Once done successfully, run the npm run dev command.
  4. Once the Notes application launches, the notes.sqlite file will be created in the src/main/sql folder.
  5. Click on the Request ENV From Main button, this will insert logs in the database. Then click on the Refresh Logs button to retrieve data from the database.
  6. To perform the migration, kill the app. Update the following changes in code
    # src/main/sql/util.ts
    
    // Latest Schema Version.
    export const SCHEMA_VERSION = 1;    // <-- Update to 1
    
  7. Rerun the npm run dev command.
  8. Once the Notes application launches, click on the Refresh Logs button and observe the changes.

Related Issues

This was linked to issues Nov 3, 2021
@Karna98 Karna98 marked this pull request as ready for review November 3, 2021 09:47
@Karna98 Karna98 merged commit 52cce60 into dev Nov 3, 2021
@Karna98 Karna98 mentioned this pull request Nov 3, 2021
Karna98 added a commit that referenced this pull request Nov 3, 2021
* Added better-sqlite3 support.
@Karna98 Karna98 added the feature New Feature label Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expected webpack paths are not imported. Adding Database
1 participant