CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE IF NOT EXISTS chat_record_vectors (
  id BIGSERIAL PRIMARY KEY,
  record_id BIGINT NOT NULL,
  keywords_text TEXT NOT NULL,
  embedding vector(1024) NOT NULL,
  created_at BIGINT NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS uq_chat_record_vectors_record_id
  ON chat_record_vectors(record_id);
