Skip to content

Adding default values to primary keys

Make a Supabase primary key auto-generate values. Edit the column, set its type to uuid and its default value to gen_random_uuid(), and turn on Is Unique.

  1. Click on the primary key in your table.

  2. Click "Edit column"

  3. Change the column type to uuid

  4. Set the Default Value equal to gen_random_uuid()

  5. Make sure "Is Unique" is toggled on