/// <reference path="../pb_data/types.d.ts" />
migrate(
  app => {
    const collection = app.findCollectionByNameOrId('pbc_918751319');
    if (collection.fields.fieldNames().includes('order')) {
      collection.fields.removeByName('order');
    }
    if (collection.fields.fieldNames().includes('session')) {
      collection.fields.removeByName('session');
    }
    return app.save(collection);
  },
  app => {
    const collection = app.findCollectionByNameOrId('pbc_918751319');
    if (!collection.fields.fieldNames().includes('session')) {
      collection.fields.addAt(collection.fields.length, new Field({
        cascadeDelete: false,
        collectionId: 'pbc_1092069950',
        hidden: false,
        id: 'relation882001session',
        maxSelect: 1,
        minSelect: 0,
        name: 'session',
        presentable: false,
        required: false,
        system: false,
        type: 'relation'
      }));
    }
    if (!collection.fields.fieldNames().includes('order')) {
      collection.fields.addAt(collection.fields.length, new Field({
        hidden: false,
        id: 'number882001order',
        max: null,
        min: null,
        name: 'order',
        onlyInt: false,
        presentable: false,
        required: false,
        system: false,
        type: 'number'
      }));
    }
    return app.save(collection);
  }
);
