Create generated_documents DB migration for persisting compliance documents #1121

Open
opened 2026-04-12 15:44:34 -04:00 by pook · 0 comments
Owner

Create a new SQL migration file in the migrations/ directory (follow existing naming convention). Table: generated_documents with columns: id (UUID PRIMARY KEY DEFAULT gen_random_uuid()), user_id (UUID NOT NULL REFERENCES users(id)), document_type (VARCHAR(50) NOT NULL — one of 'privacy_policy', 'terms_of_service', 'cookie_policy', 'dpia', 'custom'), input_hash (VARCHAR(64) NOT NULL — SHA-256 hex of concatenated input fields), document_content (TEXT NOT NULL — full generated document text), model_used (VARCHAR(50)), token_count (INTEGER), created_at (TIMESTAMP DEFAULT NOW()). Add indexes: CREATE INDEX idx_generated_documents_user_id ON generated_documents(user_id) and CREATE UNIQUE INDEX idx_generated_documents_hash_user ON generated_documents(input_hash, user_id, document_type). This is separate from the processing tables migration (#692) — this stores the final document output for user retrieval, which is a revenue blocker.


Generated by CEO Planner (priority: 2)

Create a new SQL migration file in the migrations/ directory (follow existing naming convention). Table: generated_documents with columns: id (UUID PRIMARY KEY DEFAULT gen_random_uuid()), user_id (UUID NOT NULL REFERENCES users(id)), document_type (VARCHAR(50) NOT NULL — one of 'privacy_policy', 'terms_of_service', 'cookie_policy', 'dpia', 'custom'), input_hash (VARCHAR(64) NOT NULL — SHA-256 hex of concatenated input fields), document_content (TEXT NOT NULL — full generated document text), model_used (VARCHAR(50)), token_count (INTEGER), created_at (TIMESTAMP DEFAULT NOW()). Add indexes: CREATE INDEX idx_generated_documents_user_id ON generated_documents(user_id) and CREATE UNIQUE INDEX idx_generated_documents_hash_user ON generated_documents(input_hash, user_id, document_type). This is separate from the processing tables migration (#692) — this stores the final document output for user retrieval, which is a revenue blocker. --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1121
No description provided.