only-cliches/Nano-SQL

AI table not created in Cordova

nerdoza opened this issue · 0 comments

Which version are you using?
nano-sql/adapter-sqlite-cordova: 2.1.2
nano-sql/core: 2.3.7

Describe the bug
The Adapter-SQLite-Cordova package does not initialize the Automatic Increment table before creating a table which causes an error: sqlite3_prepare_v2 failure: no such table: _ai

Resolution
https://github.com/ClickSimply/Nano-SQL/blob/af74705e3fc4be6e65c0e4044f7dc7c5b745886c/packages/Adapter-SQLite-Cordova/src/index.ts#L51-L59

In the connect method call, rather than calling complete following the creation of the database, there should be a second call to create the _ai table using createAI as seen in other adapters.

https://github.com/ClickSimply/Nano-SQL/blob/c502a60735f77dd04fa5411197a9e7604c3174f2/packages/Adapter-SQLite3/src/index.ts#L46-L57