Skip to content
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

Add metadata to local_channels table #1724

Merged
merged 5 commits into from
Mar 10, 2021
Merged

Add metadata to local_channels table #1724

merged 5 commits into from
Mar 10, 2021

Commits on Mar 10, 2021

  1. rename Auditor to DbEventHandler

    Move it to the `db` package (it was in the `payments` package for
    historical reasons but doesn't deal only with payment anymore).
    
    Better typing for channel lifecycle event.
    pm47 committed Mar 10, 2021
    Configuration menu
    Copy the full SHA
    7c3119a View commit details
    Browse the repository at this point in the history
  2. add meta info to local_channels table

    Here is the rationale for implementing channel metadata as additional
    columns in the `local_channels` table of the `channels` db, as opposed
    to a dedicated `channel_metadata` table of a `audit` db:
    
    1) There is a migration to do (in the `local_channels` table, no less!),
    but it's just a table migration, as opposed to a data migration, if we
    had to populate a new table in a separate database.
    2) We don't need to worry about creating a new metadata line when a new
    channel is created (compared to doing add-or-update stuff). It's only
    _updating_ optional columns in a best-effort manner.
    3) We don't need to worry about inconsistencies between two tables
    located in two separated databases (that's a big one).
    4) We may want to use the metadata during operations, not just for
    audit purposes. For example to close channels that have stayed unused
    for a long time.
    5) The audit db is an append-only log of events and shouldn't be used
    for anything else. There is no `UPDATE` sql statement in
    `*AuditDb.scala`. The `channel_metadata` would break that heuristic.
    pm47 committed Mar 10, 2021
    Configuration menu
    Copy the full SHA
    1436ed8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4939921 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b46a27f View commit details
    Browse the repository at this point in the history
  5. add migration test to postgres

    pm47 committed Mar 10, 2021
    Configuration menu
    Copy the full SHA
    662bf2b View commit details
    Browse the repository at this point in the history