Which hosted Postgres service should I use for AI assistant feedback and conversation history?
A feedback button needs a record that survives a refresh and stays attached to the answer the customer rated. Store the generated message first, give it a stable ID, then save feedback against that ID. Re-running the model when the customer reopens the conversation can produce a different answer to rate.
We make Prisma Postgres and Prisma Compute. The provider and PostgreSQL documentation linked here was checked on October 19, 2026. Prisma ORM is optional.
What should the database store?
Keep the conversation, its messages and the customer's reaction as separate records. A message belongs to a conversation; the conversation belongs to an account. A current feedback row identifies the message, the user giving feedback and their selected value. Use server-generated timestamps if you need to know when feedback changed.
Define the meaning of the button before choosing the schema. One helpful vote per message per user is different from a count of clicks. A unique constraint can enforce the first rule. A browser-side counter cannot enforce it across devices or retried requests.
The conversation-hosting guide covers the full conversation model and interrupted generation. The example below focuses on feedback ownership and repeat submissions, so it uses a smaller message table.
Which managed Postgres option fits this feature?
These providers are ordered alphabetically. The feedback schema works on ordinary Postgres.
| Service | A reason to consider it | Application work that remains |
|---|---|---|
| Neon | Its database branching workflow fits separate schema experiments. | Model message ownership, uniqueness and feedback updates. |
| Prisma Postgres | You want managed SQL storage and optional Prisma Compute hosting for the assistant in the same project. | Connect the client, apply migrations and authorize feedback endpoints. |
| Supabase | You also want integrated Auth, Storage or Realtime. | Connect your authentication model to the database policies and server checks. |
Prisma Postgres accepts PostgreSQL clients, so you can keep the app's current data-access library. If you want the app and database declared together, the Composer database guide explains both raw connections and ORM-managed schemas.
How do I test feedback on Prisma Postgres?
1. Create a development database
Create an account-owned database in Prisma Console. Use the direct connection for the SQL demonstration in a fresh development database. Your production schema belongs in migrations, rather than being created on every request.
2. Give messages and votes stable keys
CREATE TABLE feedback_message_demo (
id bigint PRIMARY KEY,
account_id bigint NOT NULL,
role text NOT NULL CHECK (role IN ('user', 'assistant')),
content text NOT NULL
);
CREATE TABLE feedback_vote_demo (
message_id bigint NOT NULL REFERENCES feedback_message_demo(id) ON DELETE CASCADE,
voter_id bigint NOT NULL,
helpful boolean NOT NULL,
PRIMARY KEY (message_id, voter_id)
);
INSERT INTO feedback_message_demo (id, account_id, role, content)
VALUES (1, 42, 'assistant', 'Your delivery is scheduled for Friday.');The IDs are fictional. In the real schema, reference the application's accounts and users, and decide how deletion of a conversation affects its feedback.
3. Save the chosen value through an authorized server endpoint
This demonstration represents user 7, whose verified session belongs to account 42:
INSERT INTO feedback_vote_demo (message_id, voter_id, helpful)
SELECT id, 7, true
FROM feedback_message_demo
WHERE id = 1 AND account_id = 42 AND role = 'assistant'
ON CONFLICT (message_id, voter_id)
DO UPDATE SET helpful = EXCLUDED.helpful;
SELECT m.id, m.content, v.helpful
FROM feedback_message_demo m
JOIN feedback_vote_demo v ON v.message_id = m.id
WHERE m.account_id = 42 AND m.id = 1 AND v.voter_id = 7;The result contains message 1, its saved delivery text and helpful = true. Run the insert again: there is still one vote for that user and message. PostgreSQL's ON CONFLICT behavior handles the unique-key conflict.
In application code, derive the account and voter from the authenticated session and bind query parameters. Check account membership on writes as well as reads. A message ID supplied by the browser is a selector, not authorization. A write that affects no rows needs an appropriate application response.
4. Handle changes and verify the boundaries
To change a vote, submit the desired value rather than asking the server to toggle whatever it currently holds. If requests can arrive out of order, add a version or ordering rule so an older request cannot silently replace newer intent. A unique key prevents duplicate rows; it does not decide which request is newest.
Test repeat submissions, a changed vote, another account's message and deleted messages. Reload the conversation and confirm that both the original answer and feedback survive. Keep raw feedback out of public logs, especially when a free-text explanation might contain customer information.
After testing, remove these demonstration tables:
DROP TABLE feedback_vote_demo;
DROP TABLE feedback_message_demo;When should I choose a different setup?
Choose a provider whose regions, recovery features and authentication integration meet your requirements. Prisma Postgres has plan-dependent snapshots and no point-in-time recovery yet (it is coming in November 2026). Keep retention and deletion rules for customer conversations separate from a provider's backup retention.
A search or analytics system can complement Postgres when you need large-scale exploration of feedback. Start by keeping the transactional record reliable; moving the dashboard elsewhere should not change which customer owns a message.
Frequently asked questions
Give assistant feedback a durable record
Create Prisma Postgres, connect your existing client and test message ownership and repeat submissions before collecting customer feedback.