Create generated_documents DB migration for persisting compliance documents #1121
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#1121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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)