Skip to content

multi: switch on graph SQL migration - #10163

Merged
ellemouton merged 2 commits into
lightningnetwork:masterfrom
ellemouton:graphMigFlipSwitch
Sep 5, 2025
Merged

ellemouton merged 2 commits into
lightningnetwork:masterfrom
ellemouton:graphMigFlipSwitch

Conversation

@ellemouton

@ellemouton ellemouton commented Aug 15, 2025 •

Copy link
Copy Markdown
Collaborator

This PR moves the graph SQL migration into the prod build.

With this, the graph SQL migration work is complete.

Fixes #9795

@ellemouton ellemouton self-assigned this Aug 15, 2025
@ellemouton
ellemouton marked this pull request as draft August 15, 2025 11:52

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ellemouton, 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 integrates the graph SQL migration into the main production build of the application. Previously, this migration logic might have been confined to test or development environments. By moving it into the production build, the system is prepared to transition the graph data from a key-value store to a native SQL schema, enabling a more robust and scalable data management approach for graph-related information. This change is part of a broader effort to modernize the database backend.

Highlights

  • Production-ready Graph Migration: The core logic for migrating graph data from the key-value store to a native SQL schema (version 10) has been moved into the production build configuration, enabling the system to transition graph data in a production environment.
  • Unified Database Builder: The "DefaultDatabaseBuilder" now directly handles the attachment of the graph migration function and the initialization of the SQL-backed graph store, centralizing database setup and streamlining the build process.
  • Refactored Migration Definitions: Graph migration entries (versions 9 and 10) have been moved from development-specific migration lists to the main "sqldb/migrations.go" file, signifying their official inclusion and broader applicability.
  • Streamlined Test Configuration: Configuration files related to testing native SQL have been simplified by removing redundant graph migration logic, as this is now part of the production build, reducing complexity and potential for discrepancies.
  • Test Adaptations: The "lnd_graph_migration_test.go" test no longer requires a specific build tag to run, reflecting that the graph migration is now a standard part of the production build process and its associated tests should run by default.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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. ↩

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@ellemouton
ellemouton changed the base branch from elle-graph-base to master September 4, 2025 14:34
@ellemouton
ellemouton marked this pull request as ready for review September 4, 2025 14:34
@ellemouton ellemouton changed the title [draft] multi: switch on graph SQL migration multi: switch on graph SQL migration Sep 4, 2025
@ellemouton ellemouton added this to the v0.20.0 milestone Sep 4, 2025

@bhandras bhandras left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, great to see this finally happening! 🎉

Comment thread config_test_native_sql.go
// getSQLMigration returns a migration function for the given version.
func (d *DefaultDatabaseBuilder) getSQLMigration(ctx context.Context,
version int, kvBackend kvdb.Backend) (func(tx *sqlc.Queries) error,
func (d *DefaultDatabaseBuilder) getSQLMigration(_ context.Context,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still need the test_native_sql tag?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah - it is being used for the payments SQL work

In this commit, the graph SQL migration is added to the production
build.

@ziggie1984 ziggie1984 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, Congratulations finishing this huge milestone and leading the way in the overall SQL development in LND 🎉💪🤝

@ellemouton
ellemouton merged commit 9d74ec4 into lightningnetwork:master Sep 5, 2025
68 of 73 checks passed
@ellemouton
ellemouton deleted the graphMigFlipSwitch branch September 5, 2025 04:54
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.

[epic]: graph db: SQL implementation & migration

3 participants