Skip to content

feat: Read DATABASE_URL from environment in dbmate wrapper - #414

Merged
kalbasit merged 1 commit into
mainfrom
dbmate-wrapper-use-envvar
Jan 2, 2026
Merged

kalbasit merged 1 commit into
mainfrom
dbmate-wrapper-use-envvar

Conversation

@kalbasit

@kalbasit kalbasit commented Jan 2, 2026

Copy link
Copy Markdown
Owner

This PR modifies the dbmate-wrapper to prioritize the DATABASE_URL environment variable when determining the database connection URL. Previously, the wrapper only looked for the URL in command-line arguments, but now it first checks the environment variable and uses that as the default value. The PR also improves variable initialization by directly declaring hasMigrationsDir as a boolean with a default value of false.

This makes it work in the same way dbmate itself works by honoring --url and DATABASE_URL.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @kalbasit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the dbmate-wrapper by introducing support for reading the DATABASE_URL from environment variables. This change improves the flexibility and configurability of the wrapper, making it easier to manage database connections, especially in containerized or CI/CD environments, by mirroring dbmate's native behavior.

Highlights

  • Environment Variable Priority: The dbmate-wrapper now prioritizes reading the DATABASE_URL from environment variables, aligning its behavior with dbmate itself.
  • Command-Line Argument Fallback: If the DATABASE_URL environment variable is not set, the wrapper will fall back to checking command-line arguments for the URL.
  • Variable Initialization Refinement: The hasMigrationsDir variable's initialization has been refactored for clarity, changing from an immediate assignment to a simple declaration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@dosubot

dosubot Bot commented Jan 2, 2026 •

Copy link
Copy Markdown

Related Documentation

Checked 7 published document(s) in 0 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request modifies nix/dbmate-wrapper/src/main.go to initialize the dbURL variable directly from the DATABASE_URL environment variable. It also updates comments to reflect this change and alters the hasMigrationsDir variable's initialization from an explicit false to a simple boolean declaration.

@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from e47b29c to 0e7d53f Compare January 2, 2026 04:52
@kalbasit
kalbasit force-pushed the align-docker-image branch 2 times, most recently from 11976c0 to 1583809 Compare January 2, 2026 05:04
@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from 0e7d53f to 7ca2f6f Compare January 2, 2026 05:04
@kalbasit
kalbasit force-pushed the align-docker-image branch from 1583809 to f9dd856 Compare January 2, 2026 05:06
@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from 7ca2f6f to 3b62a43 Compare January 2, 2026 05:06
@kalbasit
kalbasit force-pushed the align-docker-image branch 2 times, most recently from ed603b9 to 8fb13ab Compare January 2, 2026 05:31
@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from 3b62a43 to b046e8d Compare January 2, 2026 05:32
@kalbasit
kalbasit changed the base branch from align-docker-image to graphite-base/414 January 2, 2026 05:43
@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from b046e8d to 8d986ed Compare January 2, 2026 05:44
@kalbasit
kalbasit changed the base branch from graphite-base/414 to main January 2, 2026 05:44
@kalbasit
kalbasit force-pushed the dbmate-wrapper-use-envvar branch from 8d986ed to 06fa7da Compare January 2, 2026 05:44
@kalbasit
kalbasit merged commit e54eb06 into main Jan 2, 2026

kalbasit commented Jan 2, 2026

Copy link
Copy Markdown
Owner Author

Merge activity

@kalbasit
kalbasit deleted the dbmate-wrapper-use-envvar branch January 2, 2026 05:54
@kalbasit kalbasit added this to the v0.6.0 - High Availability milestone Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant