简体   繁体   中英

How to use an existing database file (.db) to an ionic 6 and capacitor

I am completely new to ionic with angular and i tried a lot of different things to import a.db file to an ionic capacitor with angular i have used sqlite plugin which only allows you to create a db (i thinked to convert the db file to a sql file and import it like manually) i tried to use sqlitedbcopy but while running it doesn´t find the.db file but i checked to the xcode project or android project and the file is copied, but strangely it doesn´t find it i am completely frustrated because i am completely out of new ideas so i am begging right now for help:D hehe, thank you in advance

I think sqlitedbcopy is having an issue with Capacitor but works perfectly with Cordova. https://github.com/an-rahulpandey/cordova-plugin-dbcopy/issues/69

If it's possible, try to import.sql instead of.db file with SQLite Porter https://ionicframework.com/docs/native/sqlite-porter

I think you are looking for this. It's possible to copy the.db file with below capacitor module. https://github.com/capacitor-community/sqlite

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM