Files
cloudlense/website-monitoring-frontend/crawl-progress-migration.sql
T
Dennis 14a32bdc0d feat: initialize monorepo with full dev team best practices
- Unified monorepo with backend (Express), frontend (Next.js), and devops
- Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example
- Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing
- DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks
- CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration)
- DX: Husky pre-commit hooks with smart change detection
- Docs: Root README with architecture, CONTRIBUTING.md, PR template

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:05:50 +01:00

21 lines
872 B
SQL

-- Add new columns for improved crawl progress tracking
ALTER TABLE crawl_sessions
ADD COLUMN IF NOT EXISTS total_urls INTEGER DEFAULT 0,
ADD COLUMN IF NOT EXISTS processed_urls INTEGER DEFAULT 0,
ADD COLUMN IF NOT EXISTS progress_percentage INTEGER DEFAULT 0,
ADD COLUMN IF NOT EXISTS current_url TEXT;
-- Update existing sessions to use new columns (map old data)
UPDATE crawl_sessions
SET
total_urls = pages_discovered,
processed_urls = pages_processed,
progress_percentage = CASE
WHEN pages_discovered > 0 THEN ROUND((pages_processed::float / pages_discovered::float) * 100)
ELSE 0
END
WHERE total_urls IS NULL OR total_urls = 0;
-- Add index for better performance
CREATE INDEX IF NOT EXISTS idx_crawl_sessions_status ON crawl_sessions(status);
CREATE INDEX IF NOT EXISTS idx_crawl_sessions_website_status ON crawl_sessions(website_id, status);