Last active
June 28, 2017 09:00
-
-
Save kythanh/026d4c205ad454c9af227f109466d098 to your computer and use it in GitHub Desktop.
Using uuid_generate_v4() to generate GUID on PostgreSQL
This file contains hidden or 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
--1. First to enable the extention: | |
CREATE EXTENSION "uuid-ossp"; | |
--2. Then Alter the PK column | |
alter table my_table alter column id set Default uuid_generate_v4(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment