db: add Postgres support to db command#909
Open
SanHacks wants to merge 4 commits into
Open
Conversation
Committer: Gundo Sifhufhi<sifhufhisg@gmail.com>
Support Postgres for connect/import/dump while keeping MySQL behavior.
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.
PR/Issue template (filled for this change)
Check List
[ ] Matching PR in the documentation repo (add link if/when created)
[ ] Entry in CHANGELOG.md
Is your feature request related to a problem? Please describe.
warden db currently assumes a MySQL/MariaDB container (MYSQL_* env vars) and can’t be used against environments that run Postgres.
Describe the solution you've submitted
Updated commands/db.cmd to detect whether the db service is Postgres (by checking for POSTGRES_* env vars) and route subcommands accordingly:
connect: uses psql for Postgres, mysql for MySQL/MariaDB
import: uses psql for Postgres, existing MySQL import pipeline remains unchanged
dump: uses pg_dump for Postgres, mysqldump for MySQL/MariaDB
Describe alternatives you've considered
Keeping separate commands (e.g. db-mysql / db-postgres) or adding a required flag to force DB type, but auto-detection keeps existing workflows unchanged.
Additional context
Tested locally by running warden db connect and warden db dump against both MySQL and Postgres-backed environments.