Optional Postgres support for self-hosting
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, javascript, node.js, postgresql, sqlite
- Domain
- backend, database, devops, documentation
Research direction
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.
Written by the indexing model from the issue text.
Description
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.jsfor Postgres: autoincrement ids,INTEGERbooleans, text dates andINSERT OR IGNOREstyle statements all differ. - Find and fix SQLite-only SQL across
backend/routes/andbackend/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 testgreen 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.jspasses.
Large change: please comment with a plan and split it into several pull requests.
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sennaicodes/codearena
-
Add issue and pull request templatesMay be free again @franciscorodr26 claimed this 17 days ago, and no pull request is open. Opendocumentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
sennaicodes/codearena#13 · 1 comment ·
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 45/100
sennaicodes/codearena#34 ·
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 35/100
sennaicodes/codearena#33 ·
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 45/100
sennaicodes/codearena#32 ·
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 38/100
sennaicodes/codearena#31 ·
All issues in sennaicodes/codearena
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
flarum/framework#5301 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AOSSIE-Org/BabyNest#284 ·
Maintainers usually reply within 1 day
-
status:untriaged
Difficulty 1/5 Under an hour Newbie friendliness 86/100
midnightntwrk/servicedesk#275 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
seek4science/seek#2762 ·
Maintainers usually reply within 5 days