CreateTestUsers

struct CreateTestUsers : AsyncMigration

A Migration that creates a set of test users during startup, so that there exists one at each .accessLevel. This migration should only be run in non-production environments.

  • Declaration

    Swift

    static let usernames: [String : UserAccessLevel]
  • prepare(on:) Asynchronous

    Required by Migration protocol. Creates a set of test users at each .accessLevel.

    Declaration

    Swift

    func prepare(on database: Database) async throws

    Parameters

    database

    A connection to the database, provided automatically.

    Return Value

    Void.

  • revert(on:) Asynchronous

    Deletes the test users. May not be safe–we haven’t actually tested deleting users much as it’s not a server feature.

    Declaration

    Swift

    func revert(on database: Database) async throws

    Parameters

    database

    A connection to the database, provided automatically.

    Return Value

    Void.