1- CREATE TABLE services (
1+ -- changeset Erangi Ariyasena:rag-script-v6-changeset1
2+
3+ -- Custom types used:
4+ CREATE TYPE ruuter_request_type AS ENUM (' GET' , ' POST' );
5+ CREATE TYPE service_state AS ENUM (' active' , ' inactive' , ' draft' );
6+
7+ CREATE TABLE public .services (
28 -- Primary key
3- id BIGSERIAL PRIMARY KEY ,
9+ id BIGINT PRIMARY KEY ,
410
511 -- Basic service information
612 name TEXT NOT NULL ,
@@ -10,8 +16,8 @@ CREATE TABLE services (
1016 -- Service classification
1117 ruuter_type ruuter_request_type DEFAULT ' GET' , -- ENUM: 'GET' or 'POST'
1218 current_state service_state DEFAULT ' draft' , -- ENUM: 'active', 'inactive', 'draft'
13- is_common BOOLEAN NOT NULL DEFAULT false ,
14- deleted BOOLEAN NOT NULL DEFAULT false ,
19+ is_common BOOLEAN NOT NULL DEFAULT FALSE ,
20+ deleted BOOLEAN NOT NULL DEFAULT FALSE ,
1521
1622 -- Intent classification data (for LLM)
1723 slot TEXT NOT NULL DEFAULT ' ' ,
@@ -23,10 +29,12 @@ CREATE TABLE services (
2329 endpoints JSON NOT NULL DEFAULT ' []' ,
2430
2531 -- Timestamps
26- created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
27- updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
32+ created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ,
33+ updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ,
34+ CONSTRAINT services_pkey PRIMARY KEY (id)
35+
2836);
2937
30- -- Custom types used:
31- CREATE TYPE ruuter_request_type AS ENUM ( ' GET ' , ' POST ' );
32- CREATE TYPE service_state AS ENUM ( ' active ' , ' inactive ' , ' draft ' );
38+ -- Create index for unique service_id for faster lookups
39+ CREATE UNIQUE INDEX idx_services_service_id ON public . services (service_id );
40+
0 commit comments