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

PouchDB ^6.4.3 - Database location or iosDatabaseLocation setting is now mandatory in openDatabase call #87

Open
CarlosAyala opened this issue Jun 12, 2018 · 5 comments

Comments

@CarlosAyala
Copy link

CarlosAyala commented Jun 12, 2018

Hi.

I have this issue when run this library in Android

Database location or iosDatabaseLocation setting is now mandatory in openDatabase call

My code:

this._DB = new PouchDB('curriculum.db', { adapter: 'cordova-sqlite' });

If I change my code for fix this issue to

this._DB = new PouchDB('curriculum.db', { adapter: 'cordova-sqlite', iosDatabaseLocation: 'Library', androidDatabaseImplementation: 2 });
the next error is shown

{
adapter: string,
iosDatabaseLocation: string,
androidDatabaseImplementation: number
} is not assignable to parameter of type 'DatabaseConfiguration'

@darshantejani007
Copy link

I had the same error. Doing this worked for me.

{ 
    adapter: 'cordova-sqlite',
    location: 'default',
    androidDatabaseImplementation: 2
}

@CarlosAyala
Copy link
Author

Hi @darshantejani007 .

How do you fixed this issue? I used your code with no luck, still showing me the same error:

{ adapter: string, location: string, androidDatabaseImplementation: number } is not assignable to parameter of type 'DatabaseConfiguration

@rolenjace
Copy link

this._DB =( new PouchDB as any)('curriculum.db', {
adapter: 'cordova-sqlite',
location: 'default',
androidDatabaseImplementation: 2
});

@coffeymatt
Copy link

coffeymatt commented Jun 21, 2019

I'm hitting this problem also. I've tried updating my config as above (and tried things like 'name'):

this.caseDb = (new PouchDB as any)(
          'cases.db', 
          {
            name: 'cases.db',
            adapter: 'cordova-sqlite',    
            location: 'default',         
            iosDatabaseLocation: 'default',
            androidDatabaseImplementation: 2,            
            revs_limit: 1, 
            auto_compaction: true
          }
        );

Unfortunately, the error then changes to:

ERROR Error: Uncaught (in promise): Error: Missing/invalid DB name
Error: Missing/invalid DB name
at new PouchDB (http://localhost/vendor.js:145165:11)
at http://localhost/main.js:1890:33

Anyone got this to work recently? (am using in an Ionic4/Angular/Capacitor context)

@coffeymatt
Copy link

The method signature above ("this.caseDb = (new PouchDB as any)(..." doesn't work, but this does:

this.caseDb = new PouchDB(
          'cases.db', 
          {
            adapter: 'cordova-sqlite',    
            location: 'default',         
            iosDatabaseLocation: 'default',
            androidDatabaseImplementation: 2,            
            revs_limit: 1, 
            auto_compaction: true
          }
        );

But only compiles in an angular project with custom type definitions. I've submitted a PR to add a type for this project:

DefinitelyTyped/DefinitelyTyped#36395

In the mean time, I should be able to run with that type manually dropped into my project (the index.d.ts file).

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

No branches or pull requests

4 participants