Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1493] [Alloy] Alloy sql adapter db_file to be function

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2016-09-20T20:06:29.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0, alloy 1.9.3
ComponentsModels
Labelsadapter, sqlite
ReporterHazem Khaled
AssigneeBruce Wayne
Created2016-04-21T09:54:56.000+0000
Updated2016-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
        }
    }
};
https://github.com/appcelerator/alloy/pull/788

Comments

  1. Sharif AbuDarda 2016-04-21

    Thanks for creating the PR. Please create a sample test case. Thanks.
  2. Hazem Khaled 2016-04-21

    @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
  3. Chee Kiat Ng 2016-04-21

  4. Hazem Khaled 2016-09-15

    Test app added, sorry for late
  5. Feon Sua Xin Miao 2016-09-20

    PR merged.

JSON Source