codenuk_backend_mine/services/requirement-processor/migrations/README.md

63 lines
1.7 KiB
Markdown

# Requirement Processor Migrations
This directory contains database migrations for the requirement processor service.
## Running Migrations
### Option 1: Using Python Script
```bash
cd /home/tech4biz/Desktop/Projectsnew/CODENUK1/codenuk-backend-live/services/requirement-processor/migrations
python migrate.py
```
### Option 2: Manual SQL Execution
```bash
# Connect to your database and run:
psql -d dev_pipeline -f 001_business_context_tables.sql
```
### Option 3: Using Docker
```bash
# If using Docker Compose
docker-compose exec postgres psql -U postgres -d dev_pipeline -f /migrations/001_business_context_tables.sql
```
## Migration Files
- `001_business_context_tables.sql` - Creates business context tables with JSONB structure
- `business_context_responses` - Stores user responses with questions array
- `question_templates` - Reusable question templates
## Database Schema
### business_context_responses
```sql
- id: UUID (Primary Key)
- user_id: UUID (Required)
- template_id: UUID (Optional)
- project_id: UUID (Foreign Key to projects)
- questions: JSONB Array of {question, answer} objects
- status: VARCHAR ('in_progress', 'completed', 'draft')
- created_at, updated_at: TIMESTAMP
```
### question_templates
```sql
- id: UUID (Primary Key)
- template_name: VARCHAR
- questions: JSONB Array of question templates
- is_active: BOOLEAN
- created_at: TIMESTAMP
```
## Environment Variables
Make sure these are set:
```bash
DATABASE_URL=postgresql://postgres:password@localhost:5432/dev_pipeline
```
## Integration with Requirement Processor
The business context data will be available to your requirement processor service for enhanced analysis and better requirement understanding.