Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions .github/workflows/schema-review-curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,53 +67,22 @@ jobs:
# Read the SQL file content
SQL_CONTENT=$(cat "$sql_file")

# Build the review prompt
PROMPT="You are an expert PostgreSQL schema reviewer.
# Build a simple review prompt
PROMPT="You are an expert PostgreSQL schema reviewer. Review this SQL file: $sql_file

Review this SQL file against ISV Schema Review Guidelines:

**File:** $sql_file

**SQL Content:**
\`\`\`sql
SQL Content:
$SQL_CONTENT
\`\`\`

**Check for:**
1. Primary key must start with tenant_id (or partition_id, tenant_id if partitioned)
2. Use TIMESTAMPTZ for all timestamp fields (not TIMESTAMP)
3. Tables must have 'created' and 'last_modified' TIMESTAMPTZ fields
4. No foreign key constraints (application handles referential integrity)
5. Use TEXT instead of VARCHAR or CHAR
Check for:
1. Primary key must start with tenant_id
2. Use TIMESTAMPTZ for timestamps (not TIMESTAMP)
3. Tables must have created and last_modified TIMESTAMPTZ fields
4. No foreign key constraints
5. Use TEXT instead of VARCHAR
6. No LISTEN/NOTIFY usage
7. Meaningful table and column names
8. Comments on tables and columns
9. Clustering index specified

**Output Format:**
Generate a detailed markdown report with:

## 📄 File: \`$sql_file\`

### ❌ Critical Issues (count)
For each critical issue:
- **Line X:** Description
- **Current:** \`problematic code\`
- **Fix:** \`corrected code\`
- **Why:** Explanation

### ⚠️ Warnings (count)
For each warning:
- **Line X:** Description
- **Suggestion:** Recommendation

### ✅ Passed Checks (count)
List checks that passed
7. Meaningful names and comments

### Summary
- Critical: X 🔴
- Warnings: X 🟡
- Status: BLOCKED/NEEDS_REVIEW/APPROVED"
Provide a detailed markdown report with critical issues, warnings, and passed checks."

# Escape the prompt for JSON
PROMPT_JSON=$(echo "$PROMPT" | jq -Rs .)
Expand Down Expand Up @@ -191,7 +160,7 @@ EOF
echo "📝 Generating combined report..."

# Start the report
cat > combined_review.md << 'HEADER'
cat > combined_review.md << HEADER
## 🤖 Bob AI Schema Review

**PR:** #${{ github.event.pull_request.number }}
Expand Down Expand Up @@ -241,7 +210,7 @@ SUMMARY
fi

# Add footer
cat >> combined_review.md << 'FOOTER'
cat >> combined_review.md << FOOTER

---

Expand Down Expand Up @@ -333,4 +302,3 @@ FOOTER
fi
echo ""

# Made with Bob