Open xpd54 opened 6 years ago
Encrypted Core Data generates table and column names which are different from ones generated by Core Data. Looks like you have to write you own migration.
Hi, I'm facing the same problem. I tried both encrypted core data and also command line (sqlcipher only), both methods generated new tables like ecdUsers and ZUSERS.
To answer sjlombardo's question, encrypted.db not exists when I run export.
By the way, the original db file contains only ZUSERS, the new ecdUsers table has no record, and sqlcipher is trying to read from ecdUsers so no result can be fetched.
I also created a new Xcode project with nothing but a core data setup. I can reproduce the issue so it's not because my existing project.
Hi, I am trying to use Encrypted Core Data in one of our existing project. In Our existing production app we have few MBs of data, right now we are trying to migrate our existing database to encrypted database.
Following are the steps for Demo Project.
Problem we are facing
After pointing to the encrypted database it seems it’s reading from different tables.
Reading from
2018-01-05 20:17:44.029262+0800 test[61445:4402622] SQL DEBUG: BEGIN EXCLUSIVE; 2018-01-05 20:17:44.029499+0800 test[61445:4402622] SQL DEBUG: PRAGMA case_sensitive_like = true; 2018-01-05 20:17:44.029768+0800 test[61445:4402622] SQL DEBUG: SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='meta'; 2018-01-05 20:17:44.029993+0800 test[61445:4402622] SQL DEBUG: CREATE TABLE meta(plist); 2018-01-05 20:17:44.030798+0800 test[61445:4402622] SQL DEBUG: CREATE TABLE ecdUser ('__objectid' integer primary key, 'admin', 'age', 'name'); 2018-01-05 20:17:44.031233+0800 test[61445:4402622] SQL DEBUG: DELETE FROM meta; 2018-01-05 20:17:44.031349+0800 test[61445:4402622] SQL DEBUG: INSERT INTO meta (plist) VALUES(?);
Written In CoreData: sql: INSERT INTO ZUSER(Z_PK, Z_ENT, Z_OPT, ZADMIN, ZAGE, ZNAME) VALUES(?, ?, ?, ?, ?, ?) CoreData: sql: INSERT INTO ZUSER(Z_PK, Z_ENT, Z_OPT, ZADMIN, ZAGE, ZNAME) VALUES(?, ?, ?, ?, ?, ?) CoreData: sql: INSERT INTO ZUSER(Z_PK, Z_ENT, Z_OPT, ZADMIN, ZAGE, ZNAME) VALUES(?, ?, ?, ?, ?, ?) CoreData: sql: INSERT INTO ZUSER(Z_PK, Z_ENT, Z_OPT, ZADMIN, ZAGE, ZNAME) VALUES(?, ?, ?, ?, ?, ?) CoreData: sql: INSERT INTO ZUSER(Z_PK, Z_ENT, Z_OPT, ZADMIN, ZAGE, ZNAME) VALUES(?, ?, ?, ?, ?, ?)
You can see it’s written in different table but it’s reading from some different table Which is appended by ecd
Please let me know if I am doing something wrong here.
Or If you have a way how to Use Encrypted Core Data in the already existing project. (How to do migration from old data to new)