text: /**
   * THIS FILE WAS ADDED AUTOMATICALLY by the Sails 1.0 app migration tool.
   * IT SHOULD BE MERGED into your existing config/models.js file as soon as possible.
   */
  
  module.exports.models = {
  
    // These settings make the .update(), .create() and .createEach()
    // work like they did in 0.12, by returning records in the callback.
    // This is pretty inefficient, so if you don't _always_ need this feature, you
    // should turn these off and instead chain `.meta({fetch: true})` onto the
    // individual calls where you _do_ need records returned.
    fetchRecordsOnUpdate: true,
    fetchRecordsOnCreate: true,
    fetchRecordsOnCreateEach: true,
  
    // Fetching records on destroy was experimental, but if you were using it,
    // uncomment the next line.
    // fetchRecordsOnDestroy: true,
  
    // The former `connection` model setting is now `datastore`.  This sets the datastore
    // that models will use, unless overridden directly in the model file in `api/models`.
    // It defaults to a datastore called `default`, which (unless otherwise configured in
    // the `config/datastores.js` file) uses the built-in `sails-disk` adapter.
    datastore: 'default',
  
    // These attributes will be added to all of your models.  When you create a new Sails 1.0
    // app with "sails new", a similar configuration will be generated for you.
    attributes: {
      // In Sails 1.0, the `autoCreatedAt` and `autoUpdatedAt` model settings
      // have been removed.  Instead, you choose which attributes (if any) to use as
      // timestamps.  By default, "sails new" will generate these two attributes as numbers,
      // giving you the most flexibility.  But for compatibility with your existing project,
      // we'll define them as strings.
      createdAt: { type: 'string', autoCreatedAt: true, },
      updatedAt: { type: 'string', autoUpdatedAt: true, },
      // In Sails 1.0, the primary key field is no longer created for you, and `autoPK` is
      // not a valid model option.  Instead, you define it yourself and tell Sails which
      // attribute to use as the primary key by setting the `primaryKey` setting on the model.
      // That setting defaults to `id`.
      id: { type: 'number', autoIncrement: true, }
    },
  
    migrate: 'alter',
  
    updateOrCreate: async function(criteria, values, cb){
  
      // If no values were specified, use criteria
      if (!values) {
          values = criteria.where ? criteria.where : criteria;
      }
  
      try {
          var result = await this.find(criteria).limit(1);
          if (result && result.length > 0) {
              this.update(criteria, values, cb);
          } else {
              this.create(values, cb);
          }
      } catch (err) {
          return cb(err, false);
      }
    },
  };
  