Closed DmitryAVasin closed 6 years ago
No objections to the change, but require.main
should work... how is the plugin installed?
@julianlam I changed line 3 to var db = require.main.require('../database');
and it works:
Parsing upgrade scripts...
OK | 1 script(s) found, 57 skipped
→ [2017/10/19] Convert remote-to-local user ID from hash to sorted set...
→ [2017/10/19] Convert remote-to-local user ID from hash to sorted set... OK
Schema update complete!
In plugin upgrade script, require.main
module is /path/to/nodebb/src/cli/index.js
v4.2.6
Please update in the "upgrades/session_sharing_hash_to_zset.js" file line 3:
var db = require.main.require('./src/database');
to this:
var db = module.parent.require('./database');