@sports-app/shared — the wire contract
    Preparing search index...

    Variable LEGACY_USERNAMEConst

    LEGACY_USERNAME: "local" = 'local'

    Who the data that predates usernames belongs to.

    Before v3 a browser held exactly one document and the snapshots table held exactly one stream, neither saying whose it was — so migrating either means choosing an owner, because there is no information in the file or in the database to recover one from. local is that choice, and it has to be the same choice on both sides: a client that migrates offline and a database that migrated on the server must end up naming the same person, or one user becomes two.

    It is deliberately a valid username, so migrated rows need no special case anywhere in the service. It is also honest about what those rows are: the single-user local deployment that existed before accounts did.

    The stream key is the caller's Ward subject, so the history is read again once it is reattributed to its owner's subject — one statement:

    sqlite3 db/app.db "UPDATE snapshots SET username = '' WHERE username = 'local'"