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

Use schemas in Postgres #1866

Merged
merged 1 commit into from
Jul 8, 2021
Merged

Use schemas in Postgres #1866

merged 1 commit into from
Jul 8, 2021

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Jul 7, 2021

Instead of having a flat organization under the default public schema, we classify tables in schemas. There is roughly one schema per database type.

The new hierarchy is:

  • local
    • channels
    • htlc_infos
    • pending_settlement_commands
    • peers
  • network
    • nodes
    • public_channels
    • pruned_channels
  • payments
    • received
    • sent
  • audit
    • (all the audit db tables)
  • public
    • lease
    • versions

Note in particular, the change in naming for local channels vs external channels:

  • local_channels -> local.channels
  • channels -> network.public_channels

The two internal tables lease and versions stay in the public
schema, because we have no meta way of migrating them.

@pm47 pm47 requested a review from t-bast July 7, 2021 10:02
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2021

Codecov Report

Merging #1866 (65a1446) into master (85ed433) will decrease coverage by 1.94%.
The diff coverage is 68.45%.

@@            Coverage Diff             @@
##           master    #1866      +/-   ##
==========================================
- Coverage   88.94%   86.99%   -1.95%     
==========================================
  Files         150      156       +6     
  Lines       11239    11715     +476     
  Branches      447      458      +11     
==========================================
+ Hits         9997    10192     +195     
- Misses       1242     1523     +281     
Impacted Files Coverage Δ
...ain/scala/fr/acinq/eclair/balance/Monitoring.scala 0.00% <0.00%> (ø)
.../acinq/eclair/blockchain/bitcoind/ZmqWatcher.scala 95.95% <ø> (-0.92%) ⬇️
.../main/scala/fr/acinq/eclair/channel/Register.scala 81.48% <ø> (ø)
...n/scala/fr/acinq/eclair/balance/BalanceActor.scala 11.32% <11.32%> (ø)
...r-core/src/main/scala/fr/acinq/eclair/Eclair.scala 51.04% <25.00%> (-1.10%) ⬇️
...lockchain/bitcoind/rpc/ExtendedBitcoinClient.scala 91.17% <50.00%> (-2.77%) ⬇️
...n/scala/fr/acinq/eclair/json/JsonSerializers.scala 87.17% <55.55%> (ø)
...n/scala/fr/acinq/eclair/balance/CheckBalance.scala 58.82% <58.82%> (ø)
.../src/main/scala/fr/acinq/eclair/db/Databases.scala 82.14% <60.00%> (-3.58%) ⬇️
...c/main/scala/fr/acinq/eclair/db/pg/PgPeersDb.scala 86.36% <60.00%> (-8.51%) ⬇️
... and 28 more

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM

@pm47
Copy link
Member Author

pm47 commented Jul 7, 2021

Rebased on parent PR and squashed.

Instead of having a flat hierarchy under the default `public` schema. There is roughly a schema per database type.

The new hierarchy is:
- `local`
  - `channels`
  - `htlc_infos`
  - `pending_settlement_commands`
  - `peers`
- `network`
  - `nodes`
  - `public_channels`
  - `pruned_channels`
- `payments`
  - `received`
  - `sent`
- `audit`
  - <all the audit db tables>
- `public`
  - `lease`
  - `versions`

Note in particular, the change in naming for local channels vs external channels:
- `local_channels` -> `local.channels`
- `channels` -> `network.public_channels`

The two internal tables `lease` and `versions` stay in the `public`
schema, because we have no meta way of migrating them.
@pm47
Copy link
Member Author

pm47 commented Jul 8, 2021

Parent PR merged, rebased on master.

@pm47 pm47 requested a review from t-bast July 8, 2021 13:05
@pm47 pm47 merged commit f8feb19 into master Jul 8, 2021
@pm47 pm47 deleted the pg-json-schemas branch July 8, 2021 13:48
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.

3 participants