[ALOY-1622] Migration on a model with sql adapter type: build error due to an undefined variable
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2018-07-18T21:44:36.000+0000 |
Affected Version/s | Alloy 1.13.0 |
Fix Version/s | CLI Release 7.0.5, Alloy 1.13.1 |
Components | Models |
Labels | alloy, bug, migration |
Reporter | Vittorio Sorbera |
Assignee | Ewan Harris |
Created | 2018-06-14T09:06:16.000+0000 |
Updated | 2018-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
File | Date | Size |
---|---|---|
sql-error.jpg | 2018-06-14T08:48:58.000+0000 | 113746 |
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] ?
* alloy 1.12.0 * appc-cli 7.0.3 * hyperloop 3.0.5
[~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