Rank 1: Thread
I am building a migration function that removes and recreates database collections and their indexes, permissions and records on demand.
The wrapper function:
export async function migrate (database, client, app) { await remove(database) await create(database) await attributes(database) await indexes(database) await permissions(database) await seed(database)}In the #attributes function, I create several attributes:
export async function attributes (database) { const promises = [ database.createStringAttribute(DATABASE, COLLECTION, 'code', 16, true), database.createBooleanAttribute(DATABASE, COLLECTION, 'active', true), database.createStringAttribute(DATABASE, COLLECTION, 'person', 16384, true), database.createStringAttribute(DATABASE, COLLECTION, 'personLabel', 128, true), database.createEmailAttribute(DATABASE, COLLECTION, 'personEmail', true), database.createStringAttribute(DATABASE, COLLECTION, 'personPhone', 16, true), database.createStringAttribute(DATABASE, COLLECTION, 'organization', 16384, true), database.createStringAttribute(DATABASE, COLLECTION, 'organizationLabel', 128, true) ] return Promise.all(promises)}NOTE these are async functions, so I await Promise.all(promises)
By my understanding, the library fn #create<TYPE>Attribute should resolve when the attribute is created ....