Skip to content

[feature]: add distinct SQL database migration "tracks" in sqldb #9762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
guggero opened this issue Apr 24, 2025 · 3 comments
Open

[feature]: add distinct SQL database migration "tracks" in sqldb #9762

guggero opened this issue Apr 24, 2025 · 3 comments
Labels
enhancement Improvements to existing features / behaviour
Milestone

Comments

@guggero
Copy link
Collaborator

guggero commented Apr 24, 2025

Today, the way SQL database migrations work with golang-migrate/migrate is that we only have a single "track" of migrations, meaning a single folder with migration files that need to be numbered in a strictly incremental way.

But because we'll have optional migrations in the future (either toggled through a CLI flag such as the --db.use-native-sql flag or through build tags to toggle not-yet-finished features in unit or integration tests), keeping things in strict order might become tricky.
Especially if there are multiple, distinct sub-projects working on migrating databases over to SQL (the existing invoice DB and the upcoming payments and graph databases), there are bound to be conflicts.
Also having those three (and in the future even more) distinct functionality sub-projects create files will lead to a hard-to-understand sequence of files.

We can start using different tracks if we change the following:

  • Specify a distinct MigrationsTable for each track in pgx_migrate.Config{}. The default would be schema_migrations which we would use for existing migrations (e.g. the native invoice migrations). Any new "track" would get a different name, for example: schema_migrations_payments or schema_migrations_graph. See
  • Store the files for each track in a different folder and specify that here:
    postgresFS, driver, "sqlc/migrations", dbName, target,

As a side task it would make sense to move any of the actual migration lists or feature specific functionality out of the sqldb package so it only contains generic code that can be re-used in our other projects.

@guggero guggero added the enhancement Improvements to existing features / behaviour label Apr 24, 2025
@guggero guggero added this to the v0.20.0 milestone Apr 24, 2025
@saubyk saubyk moved this to Backlog in lnd v0.20 Apr 24, 2025
@Lymah123
Copy link

Hi @guggero and @saubyk , can I work on it?

@saubyk
Copy link
Collaborator

saubyk commented Apr 24, 2025

Hi @guggero and @saubyk , can I work on it?

Hi @Lymah123 since you don't have a track record of any LND contributions yet, would recommend going through the new contributor's guideline first:
https://github.com/lightningnetwork/lnd/blob/master/docs/review.md

Assuming you are familiar with how Bitcoin & Lightning Network nodes work, first focus on learning how code contributions are made to LND by reviewing existing prs. After you have a track record of a couple of pr reviews, you should think about putting up a pr of your own.

Hope this helps. thanks.

@Lymah123
Copy link

Hi @guggero and @saubyk , can I work on it?

Hi @Lymah123 since you don't have a track record of any LND contributions yet, would recommend going through the new contributor's guideline first: https://github.com/lightningnetwork/lnd/blob/master/docs/review.md

Assuming you are familiar with how Bitcoin & Lightning Network nodes work, first focus on learning how code contributions are made to LND by reviewing existing prs. After you have a track record of a couple of pr reviews, you should think about putting up a pr of your own.

Hope this helps. thanks.

Thank you @saubyk, I will start implementing your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features / behaviour
Projects
Status: Backlog
Development

No branches or pull requests

3 participants