fn createUserV1(name: String): Unit with {Console} = {
    let user = Schema.versioned("User", 1, { name: name })
    let version = Schema.getVersion(user)
    Console.print("Created user v1: " + name + " (age unknown)")
    Console.print("User version: " + toString(version))
}

fn migrateUserToV2(name: String): Unit with {Console} = {
    let userV1 = Schema.versioned("User", 1, { name: name })
    let userV2 = Schema.migrate(userV1, 2)
    let newVersion = Schema.getVersion(userV2)
    Console.print("Migrated to v2: " + name + " (age unknown)")
    Console.print("User version after migration: " + toString(newVersion))
}

fn main(): Unit with {Console} = {
    createUserV1("Alice")
    migrateUserToV2("Alice")
}

let output = run main() with {}
