-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into tooling-wallet/rebrand-home-update-coin
- Loading branch information
Showing
7 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,25 +5,17 @@ on: | |
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
version: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # pin@v1 | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
- name: checkout code repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # [email protected] | ||
- name: Install Nodejs | ||
|
@@ -40,4 +32,4 @@ jobs: | |
# https://github.com/changesets/action#with-version-script | ||
version: pnpm changeset-version | ||
env: | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Database Schema | ||
|
||
The Indexer pulls checkpoint data from the full node and populates the tables shown in the ERD diagram: | ||
|
||
![Database Schema](./database_schema.svg) | ||
|
||
> **NOTE** | ||
> | ||
> Since all tables are populated from checkpoint data the entities are closely related, in the `SQL` files the foreign keys are not specified, a manual study of data is needed to understand all relations. | ||
> | ||
> Migrations are generated by diesel cli, the basic schema can be found [schema.rs](src/schema.rs). | ||
> For more in depth understanding of the database tables, go to [migrations](migrations) folder, in the contained `SQL` the indexes, partitions & constraints are declared. | ||
> | ||
> - Tables `objects_history` & `transactions` have partitions, each partition is created based on `checkpoint_sequence_number` (related form the `checkpoints` table) it goes from `0` to `MAXVALUE` | ||
> - `__diesel_schema_migrations` table is managed by `diesel` cli when applying migrations | ||
## Indexes | ||
|
||
### Table `checkpoints` | ||
|
||
| Index name | Keys | | ||
| ------------------ | ---------------------- | | ||
| checkpoints_epoch | epoch, sequence_number | | ||
| checkpoints_digest | checkpoint_digest | | ||
|
||
### Table `events` | ||
|
||
| Index name | Keys | | ||
| --------------------------------- | ----------------------------------------------------------------------- | | ||
| events_package | package, tx_sequence_number, event_sequence_number | | ||
| events_package_module | package, module, tx_sequence_number, event_sequence_number | | ||
| events_event_type | event_type, text_pattern_ops, tx_sequence_number, event_sequence_number | | ||
| events_checkpoint_sequence_number | checkpoint_sequence_number | | ||
|
||
### Table `objects` | ||
|
||
| Index name | Keys | Condition | | ||
| ---------------------------------- | -------------------------- | --------------------------------------------------------- | | ||
| objects_owner | owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | | ||
| objects_coin | owner_id, coin_type | WHERE coin_type IS NOT NULL AND owner_type = 1 | | ||
| objects_checkpoint_sequence_number | checkpoint_sequence_number | | | ||
| objects_type | object_type | | | ||
|
||
### Table `objects_snapshot` | ||
|
||
| Index name | Keys | Condition | | ||
| ------------------------------------------- | ------------------------------- | --------------------------------------------------------- | | ||
| objects_snapshot_checkpoint_sequence_number | checkpoint_sequence_number | | | ||
| objects_snapshot_coin | owner_id, coin_type, object_id | WHERE coin_type IS NOT NULL AND owner_type = 1 | | ||
| objects_snapshot_type | object_type, object_id | | | ||
| objects_snapshot_owner | owner_type, owner_id, object_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | | ||
|
||
### Table `objects_history` | ||
|
||
| Index name | Keys | Condition | | ||
| --------------------- | ------------------------------------------------ | --------------------------------------------------------- | | ||
| objects_history_owner | checkpoint_sequence_number, owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | | ||
| objects_history_coin | checkpoint_sequence_number, owner_id, coin_type | WHERE coin_type IS NOT NULL AND owner_type = 1 | | ||
| objects_history_type | checkpoint_sequence_number, object_type | | | ||
|
||
### Table `transactions` | ||
|
||
| Index name | Keys | Condition | | ||
| --------------------------------------- | -------------------------- | -------------------------- | | ||
| transactions_transaction_digest | transaction_digest | | | ||
| transactions_checkpoint_sequence_number | checkpoint_sequence_number | | | ||
| transactions_transaction_kind | transaction_kind | WHERE transaction_kind = 1 | | ||
|
||
### Table `tx_calls` | ||
|
||
| Index name | Keys | | ||
| --------------------------- | ----------------------------------------- | | ||
| tx_calls_module | package, module, tx_sequence_number | | ||
| tx_calls_func | package, module, func, tx_sequence_number | | ||
| tx_calls_tx_sequence_number | tx_sequence_number | | ||
|
||
### Table `tx_senders` | ||
|
||
| Index name | Keys | Condition | | ||
| ----------------------------------- | ------------------ | --------- | | ||
| tx_senders_tx_sequence_number_index | tx_sequence_number | ASC | | ||
|
||
### Tables `tx_recipients` | ||
|
||
| Index name | Keys | Condition | | ||
| -------------------------------------- | ------------------ | --------- | | ||
| tx_recipients_tx_sequence_number_index | tx_sequence_number | ASC | | ||
|
||
## Partitions | ||
|
||
### Tables `transactions`, `objects_history` | ||
|
||
| Keys | Condition | | ||
| :------------------------: | :-------------------------------: | | ||
| checkpoint_sequence_number | FOR VALUES FROM (0) TO (MAXVALUE) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters