[ALOY-456] Support multiple databases in sql adapter
GitHub Issue | n/a |
Type | Improvement |
Priority | Medium |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2013-01-17T20:07:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 0.3.5, 2013 Sprint 02 |
Components | Runtime |
Labels | alloy, notable |
Reporter | Simon Giles |
Assignee | Unknown |
Created | 2012-12-27T19:11:18.000+0000 |
Updated | 2018-03-07T22:25:48.000+0000 |
Description
update
Alloy will support multiple sqlite databases in an app one of two ways:
1. By adding the *db_name* property to the *definition.adapter* object to identify the name of the database you would like to use/create. See here: [LINK COMING]
2. By loading from an existing database with the *db_file* field (from ALOY-345). Alloy will automatically use the basename of the file as the database. So if your db_file is "myapp.sqlite", then alloy will automatically use "myapp" as the database for all operations.
It would be nice to be able to pass a database filename as part of the model.config.adapter when creating a SQL model - instead of defaulting to the _alloy_ database name. This would be helpful for situations where we might want to have multiple databases with differing configurations - for example: one database which is shared over iCloud, and one which is unshared and stored in the cahe directory.
Comments
JSON Source
test app: https://github.com/appcelerator/alloy/tree/master/test/apps/models/sql_queries