[ALOY-1493] [Alloy] Alloy sql adapter db_file to be function
| GitHub Issue | n/a | 
|---|---|
| Type | New Feature | 
| Priority | Critical | 
| Status | Resolved | 
| Resolution | Fixed | 
| Resolution Date | 2016-09-20T20:06:29.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | Release 6.0.0, alloy 1.9.3 | 
| Components | Models | 
| Labels | adapter, sqlite | 
| Reporter | Hazem Khaled | 
| Assignee | Bruce Wayne | 
| Created | 2016-04-21T09:54:56.000+0000 | 
| Updated | 2016-10-03T18:17:21.000+0000 | 
Description
// app/models/mytable.js
exports.definition = {
    config: {
        columns: {},
        adapter: {
            type: "sql",
            collection_name: "mytable",
            db_file: function() {
                var myFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'file1.sql');
                return myFile.exists() ? myFile.nativePath : Titanium.Filesystem.applicationDataDirectory + 'file2.sql';
            },
            db_name: "projectsDB",
            idAttribute: "UserID",
            remoteBackup: false
        }
    }
};
Thanks for creating the PR. Please create a sample test case. Thanks.
@sdarda Don't know a lot about your process, but i think it has to go under ALOY instead of TIMOB, i'm asking for test case directory name https://github.com/appcelerator/alloy/tree/master/test/apps/testing
Test app added, sorry for late
PR merged.