sqlite icon indicating copy to clipboard operation
sqlite copied to clipboard

The problem with including an existing SQLite database in an application build without the nativescript-sqlite plugin

Open radiance77 opened this issue 1 year ago • 0 comments

The problem with including an existing SQLite database in an application build without the nativescript-sqlite plugin

In the absence of the nativescript-sqlite plugin(https://github.com/nathanaela/nativescript-sqlite), an existing SQLite file is not included in the application build, and the openOrCreate method does not open an existing database.

However, when installing the nativescript-sqlite plugin, the SQLite file is correctly added to the application build, which allows the openOrCreate method to open an existing database without errors.

Also during the discussion of this problem in the discord on the NativeScript server https://discord.com/channels/603595811204366337/1291720688784248895 It turned out that this problem does not arise only for me https://discord.com/channels/603595811204366337/1291720688784248895/1292051031475097661

Platforms

- iOS/Android/Both 
- Android version - 13, iOS version - 17.5
- Android Device, iOS emulator

Versions:

ns -v
8.8.2
✔️ Up to date.
 "dependencies": {
    "@angular/animations": "~17.3.0",
    "@angular/cdk": "^17.3.6",
    "@angular/common": "~17.3.0",
    "@angular/compiler": "~17.3.0",
    "@angular/core": "~17.3.0",
    "@angular/forms": "~17.3.0",
    "@angular/platform-browser": "~17.3.0",
    "@angular/platform-browser-dynamic": "~17.3.0",
    "@angular/router": "~17.3.0",
    "@nativescript-community/l": "^4.3.5",
    "@nativescript-community/perms": "^2.3.3",
    "@nativescript-community/sqlite": "^3.5.1",
    "@nativescript-community/ui-collectionview": "^5.3.30",
    "@nativescript-community/ui-lottie": "^6.0.0",
    "@nativescript-community/ui-material-core": "^7.2.49",
    "@nativescript-community/ui-material-ripple": "^7.2.53",
    "@nativescript-community/ui-material-snackbar": "^7.2.49",
    "@nativescript-community/ui-material-textfield": "^7.2.53",
    "@nativescript/angular": "^17.0.0",
    "@nativescript/core": "~8.8.2",
    "@nativescript/local-notifications": "file:src/packages/local-n-package",
    "@nativescript/localize": "^5.2.0",
    "@nativescript/mlkit-barcode-scanning": "^3.0.0-alpha.3",
    "@nativescript/mlkit-core": "^3.0.0-alpha.3",
    "@nativescript/shared-notification-delegate": "^1.0.2",
    "@nativescript/theme": "~3.0.2",
    "@nativescript/unit-test-runner": "^3.0.4",
    "@ngrx/signals": "^17.2.0",
    "@ngrx/store": "^17.2.0",
    "@sergeymell/nativescript-color-wheel": "^1.0.15",
    "nativescript-drop-down": "^6.0.2",
    "nativescript-sqlite": "^2.8.6",
    "nativescript-ui-calendar": "^15.2.3",
    "nativescript-ui-listview": "^15.2.3",
    "nativescript-ui-sidedrawer": "^15.2.3",
    "rxjs": "^7.8.1",
    "zone.js": "~0.14.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~17.3.0",
    "@angular/compiler-cli": "~17.3.0",
    "@jsdevtools/coverage-istanbul-loader": "3.0.5",
    "@nativescript/android": "8.8.5",
    "@nativescript/ios": "^8.8.2",
    "@nativescript/types": "~8.7.0",
    "@nativescript/webpack": "~5.0.19",
    "@ngtools/webpack": "~17.3.0",
    "@types/jasmine": "^5.1.4",
    "karma": "6.4.3",
    "karma-coverage": "2.2.1",
    "karma-jasmine": "4.0.2",
    "karma-nativescript-launcher": "0.4.0",
    "nyc": "15.1.0",
    "typescript": "~5.4.0"
  }

How to recreate the issue.

The database file is located at the src/db/database.sqlite path, and without the nativescript-sqlite plugin, it is not included in the application build, which is why the openOrCreate method does not open an existing database.

radiance77 avatar Oct 06 '24 09:10 radiance77