Open
Conversation
- Created docker-entrypoint.sh that runs PostgreSQL migrations on startup - Updated Dockerfile to copy SQL scripts and entrypoint script - Set entrypoint to run migrations before starting Next.js server
- Replace shell-based entrypoint with Node.js migration script - Use pg and mssql npm packages for database connections - Remove need to install psql/sqlcmd in Docker image - Simplify Dockerfile by staying on Alpine base image
- Add DATABASE_URL validation before PostgreSQL connection attempts - Add SQL Server environment variable validation (SQL_SERVER_HOST, USER, PASSWORD) - Add 10-second connection timeouts for both databases - Fix mssql.close() to pool.close() for proper connection cleanup - Replace error message string matching with SQL Server error numbers (2714, 15151) - Add timeout wrapper (300s) in docker-entrypoint.sh to prevent infinite hangs - Update CONFIG_NAME detection to be more specific (_PG_, _SQLSERVER_) - Change fallback from silent skip to explicit failure when CONFIG_NAME is invalid - Remove unused execSync import Closes #1400 review feedback
- Delete scripts/run-migrations.js and move to sql/run-init.js - Simplify CONFIG_NAME matching (remove regex complexity) - Reduce timeout from 300s to 60s for faster failure detection - Update path resolution in run-init.js (use ./sql relative to __dirname) - Rename "migrations" to "init" throughout entrypoint and script messages This consolidates database initialization logic into the sql/ directory and streamlines the init script with simpler configuration matching.
- Fix path bug: sql files at ../postgres not ./sql/postgres (PR #1402 review) - Inline validation functions for simpler control flow - Simplify SQL Server database fallback (remove fragile URL parsing) - Remove redundant error number checks (string matching sufficient) - Simplify entrypoint: use $? directly, fix timeout message to 60 seconds These changes were made based on PR review feedback to improve correctness and maintainability while keeping the code simple and clear.
…ibbs-ecr-viewer into feature/add-sql-init-entrypoint Resolve merge conflicts by keeping fixed version: - Fix path resolution bug (use '../postgres' not './sql/postgres') - Inline validation functions for simpler code - Simplify SQL Server database fallback logic - Remove redundant error number checks - Fix timeout message accuracy in entrypoint This maintains the fixes from PR #1402 review while incorporating remote changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1402 +/- ##
==========================================
- Coverage 86.29% 82.93% -3.37%
==========================================
Files 258 174 -84
Lines 11488 6645 -4843
Branches 1284 1279 -5
==========================================
- Hits 9914 5511 -4403
+ Misses 1567 1130 -437
+ Partials 7 4 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
No description provided.