[ALOY-732] Alloy: Model db_name is ignored when db_file is set
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-07-08T19:56:03.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.2.0, 2013 Sprint 14 |
Components | Models |
Labels | qe-testadded |
Reporter | Fokke Zandbergen |
Assignee | Tony Lukasavage |
Created | 2013-07-02T18:39:06.000+0000 |
Updated | 2013-07-15T23:10:34.000+0000 |
Description
When you set both
db_file
to preload an existing SQLite database for a model, the db_name
gets ignored. This is because a typo in the SQLite sync adapter for which I'll do a PR.
var dbName = config.adapter.db_name = match[2];
Should be:
var dbName = config.adapter.db_name || match[2];
The PR: https://github.com/appcelerator/alloy/pull/168
Reviewed and merged. Also added a change for testing. PR: https://github.com/appcelerator/alloy/pull/168 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/models/sql_preload The existing "models/sql_preload" test app was modified to use both db_name and db_file. If you run it on iOS (from a reset), you'll notice that it lists all the expected fighter names. Additionally, if you navigate to your apps directory, in my case:
You'll see that the database file is named "fighters" instead of "myapp" now.
Verified as fixed. Environment: Titanium SDK 3.1.2.v20130710144553 Appcelerator Studio 3.1.2.201307101037 Alloy 1.2.0 Android device 4.2.2 and iOS 5. Closing.