Optional Postgres support for self-hosting

Đang mở
#30 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, javascript, node.js, postgresql, sqlite

Hướng nghiên cứu

Start by reading backend/db.js to map the existing database operations and schema, then inspect SQLite-specific SQL in backend/routes/ and backend/server.js. Run npm test and node scripts/check-boundary.js to establish the current baseline. This is explicitly a large, multi-PR change; done means both database test runs pass, a seeded SQLite database migrates with table row counts reported, and self-hosting docs are updated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement help wanted

CodeArena runs on SQLite only. That is perfect for a small instance, but a busy self-hosted copy wants a managed database with backups, replicas and more than one backend process.

Goal

Optional Postgres support selected by DATABASE_URL, with SQLite remaining the default and zero-config.

What to do

  • Put database access behind a small adapter with the operations the code already uses (run, get, all, transactions), with one implementation per engine.
  • Translate schema and migrations in backend/db.js for Postgres: autoincrement ids, INTEGER booleans, text dates and INSERT OR IGNORE style statements all differ.
  • Find and fix SQLite-only SQL across backend/routes/ and backend/server.js. List each pattern you changed in the pull request.
  • A one-way migration script that copies an existing SQLite database into an empty Postgres database and checks row counts per table.

Rules

  • Run the whole backend test suite against both engines in CI, using a Postgres service container. A feature is not done if it only passes on one.
  • No ORM rewrite. Keep the SQL readable and close to what is there.

Definition of done

  • npm test green on SQLite and Postgres.
  • A real migration of a seeded local database, with row counts in the pull request.
  • Self-hosting docs updated, including the Docker setup if #10 has landed.
  • node scripts/check-boundary.js passes.

Large change: please comment with a plan and split it into several pull requests.

Ngôn ngữ chính
JavaScript
Star
0
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sennaicodes/codearena

Tất cả issue của sennaicodes/codearena

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.