Started adding async calls for upgrading to Meteor 3.0. Numerous other fixes.

This commit is contained in:
2025-07-02 11:18:09 -07:00
parent e1216741d6
commit 2e99ad007c
32 changed files with 549 additions and 373 deletions

View File

@@ -1,3 +1,6 @@
import 'meteor/aldeed:collection2/static'
import SimpleSchema from 'meteor/aldeed:simple-schema';
let AppVersion = new Mongo.Collection('AppVersion');
let AppVersionSchema = new SimpleSchema({
version: {
@@ -9,16 +12,16 @@ let AppVersionSchema = new SimpleSchema({
AppVersion.attachSchema(AppVersionSchema);
try {
let appVersions = AppVersion.find({}).fetch();
let appVersions = await AppVersion.find({}).fetchAsync();
let appVersion;
if(!appVersions || appVersions.length == 0) { //This will happen only when first creating a database.
appVersion = {version: 0};
appVersion._id = AppVersion.insert(appVersion);
appVersion._id = await AppVersion.insertAsync(appVersion);
}
else if(appVersions.length > 1) { //This should never happen. Remove all but the first app version.
for(let i = 1; i < appVersions.length; i++) {
AppVersion.remove(appVersions[i]._id);
await AppVersion.removeAsync(appVersions[i]._id);
}
}
else {