Created
October 25, 2021 21:01
-
-
Save evolkmann/94e2e51ef52f67d7d42c9081980e253a to your computer and use it in GitHub Desktop.
Change a serial ID column to a UUID column with predictable values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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