Install the uuid-ossp Extension (if not already installed):First, make sure the uuid-ossp extension is available in your PostgreSQL database. This extension is necessary for generating UUIDs.sqlCopy code
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Add the prompt_key Column with a Default Value:You can add the prompt_key column with a default value of a generated UUID using the gen_random_uuid() function:sqlCopy code
ALTER TABLE user_prompts ADD COLUMN prompt_key UUID UNIQUE NOT NULL DEFAULT gen_random_uuid(), ADD COLUMN Formal_JSON_Schema TEXT;
This command adds the prompt_key column of type UUID with a default value generated by gen_random_uuid(), ensuring each row has a unique, non-null value.
Recent Comments