feat: Add Docker Compose setup for backend service and fix ideas.even…#99
Conversation
|
@cs-sally is attempting to deploy a commit to the flushingtech Team on Vercel. A member of the Team first needs to authorize it. |
gent1999
left a comment
There was a problem hiding this comment.
On the schema change for ideas.event_id, that column is currently a text type by design so we can store multiple event IDs (comma-separated) for a single idea. Switching it to an integer would limit us to one event per idea and break some of our existing routes like /add-event-to-idea. For now, I’ll need to reject this PR to avoid that impact.
wilrnh
left a comment
There was a problem hiding this comment.
Hey @unisally thx for helping address these 2 issues! It would help make it easier to review if we can split this PR into 2 separate PRs: one for the docker changes and one for the migrations fix.
For the docker changes, could you also please state any clear benefits you saw for adding the app to docker in this PR? Maybe this was already discussed with the team and I missed it, but it would also help if we can document the reasons for it here. It would also help us review this addition so that we are sure it's providing the benefits that were intended.
For the migrations fix, if migrations are currently failing because of a foreign key error, lets definitely discuss the best way to fix that!
Thanks again!
This PR introduces a
Dockerfileand updatesdocker-compose.ymlto allow the backend service (Node.js application) to be run and managed as a Docker container, alongside the PostgreSQL database.It also includes a crucial database schema fix in
src/db/schemas/schemas.ts.Why the schema fix was needed:
The
ideas.eventIdcolumn was previously defined astext, but it attempts to referenceevents.id, which is aninteger. This caused aforeign key constrainterror (Key columns "event_id" and "id" are of incompatible types: text and integer) during database migrations. The fix changesideas.eventIdtointegerto resolve this type mismatch and ensure proper database relationships.How to test/verify:
After pulling these changes, team members should be able to set up and run the backend by following these steps:
docker-compose up -d --build(to build the backend image and start services)docker-compose exec backend npm run db:migrate(to apply the schema changes and ensure the database is set up correctly)docker-compose exec backend npm start(to run the application)