Feat/phase 2 supabase migration - #2
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR continues the Phase 2 Supabase migration by moving parts of the approvals/notifications schema to UUIDs, updating the Postgres connection to use SSL, and refreshing the backend .env template for Supabase connectivity.
Changes:
- Update
003_init_approvals.sqlto use UUID primary/foreign keys for approvals- and notifications-related tables. - Configure
pgPool connection to enable SSL. - Update
.env.examplewith a Supabase-styleDATABASE_URLexample.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| backend/src/db/migrations/003_init_approvals.sql | Switch approvals/notifications IDs and FKs to UUIDs for Supabase alignment. |
| backend/src/config/db.js | Enable SSL in the Postgres connection pool. |
| backend/.env.example | Provide a Supabase pooler DATABASE_URL example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FRONTEND_URL=http://localhost:5173 | ||
| JWT_SECRET=change_me | ||
| DATABASE_URL=postgresql://postgres:your_password@localhost:5432/reimbursement | ||
| DATABASE_URL=DATABASE_URL=postgresql://postgres.[project-ref]:[password]@aws-1-ap-south-1.pooler.supabase.com:5432/postgres |
Comment on lines
+5
to
+8
| export const pool = new Pool({ | ||
| connectionString: env.DATABASE_URL, | ||
| ssl: { rejectUnauthorized: false }, | ||
| }); |
Comment on lines
1
to
5
| CREATE TABLE IF NOT EXISTS approval_rules ( | ||
| id SERIAL PRIMARY KEY, | ||
| id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
| rule_json JSONB NOT NULL, | ||
| manager_first_enabled BOOLEAN DEFAULT TRUE, | ||
| created_at TIMESTAMP DEFAULT NOW() |
Comment on lines
8
to
+13
| CREATE TABLE IF NOT EXISTS expense_approval_steps ( | ||
| id SERIAL PRIMARY KEY, | ||
| expense_id INT REFERENCES expenses(id), | ||
| id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
| expense_id UUID REFERENCES expenses(id), | ||
| step_no INT NOT NULL, | ||
| approver_role VARCHAR(20), | ||
| approver_id INT, | ||
| approver_id UUID, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2: supabase migration, SSL config and schema fixes done