Skip to content

Instantly share code, notes, and snippets.

@evolkmann
Created October 25, 2021 21:01
Show Gist options
  • Save evolkmann/94e2e51ef52f67d7d42c9081980e253a to your computer and use it in GitHub Desktop.
Save evolkmann/94e2e51ef52f67d7d42c9081980e253a to your computer and use it in GitHub Desktop.
Change a serial ID column to a UUID column with predictable values
alter table example_table
alter column id drop default,
alter column id set data type uuid using uuid_generate_v5(uuid_ns_url(), id::text),
alter column id set default gen_random_uuid();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment