Storing the user_id in a local database

I have an application that needs to reference a user for a particular kind of record, in development version of the database I just reference the in the table.

An example schema is here

I’d like to keep a similar option using Auth0, but can’t find an Auth0 specific data type for the user_id, this seems to change based on the identity provider.

Is there a unique id that I can use that is a standard length, or does anybody know the maximum length of the user_id?

You are correct in that the user_id field is derived from the connection/identity provider, in the format {identity provider id}|{unique id in the provider}. Because of this, there is no max length as such, due to connection names varying in length.

It is however suitable to use as the unique identifier in your custom databases.

So the best option would be to use a data type of TEXT or to create my own user_id and store that under the app_metadata section.