Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1622] Migration on a model with sql adapter type: build error due to an undefined variable

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2018-07-18T21:44:36.000+0000
Affected Version/sAlloy 1.13.0
Fix Version/sCLI Release 7.0.5, Alloy 1.13.1
ComponentsModels
Labelsalloy, bug, migration
ReporterVittorio Sorbera
AssigneeEwan Harris
Created2018-06-14T09:06:16.000+0000
Updated2018-07-18T22:12:51.000+0000

Description

I tried to do a migration on a model with sql adapter type, following the example of the guide: https://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Sync_Adapters_and_Migrations-section-src-36739597_AlloySyncAdaptersandMigrations-Example But the build fails with the error in the attached image. The problem seems to be due to a db variable that has not been defined in the /Alloy/lib/alloy/sync/sql.js file, exactly it is this: https://github.com/appcelerator/alloy/blob/6c311743af90da438f9c30bfdbe29275247daa51/Alloy/lib/alloy/sync/sql.js#L341 If I modify it in var db = Ti.Database.open(config.adapter.db_name); everything works properly.

Attachments

FileDateSize
sql-error.jpg2018-06-14T08:48:58.000+0000113746

Comments

  1. Hans Knöchel 2018-06-14

    Which Alloy- and appc-cli version do you use? This looks valid and could be a side-effect of recent strict mode or Babel changes. [~eharris] ?
  2. Vittorio Sorbera 2018-06-14

    * alloy 1.12.0 * appc-cli 7.0.3 * hyperloop 3.0.5
  3. Ewan Harris 2018-06-19

    [~hknoechel] You're more than likely correct, it looks to be due to db being assigned without ever being declared in scope, which with strict mode is an error. It looks to only be a problem on Android. PR here https://github.com/appcelerator/alloy/pull/898

JSON Source