-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
82 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- | ||
Guiding Principles: | ||
Changelogs are for humans, not machines. | ||
There should be an entry for every single version. | ||
The same types of changes should be grouped. | ||
Versions and sections should be linkable. | ||
The latest version comes first. | ||
The release date of each version is displayed. | ||
Mention whether you follow Semantic Versioning. | ||
Usage: | ||
Change log entries are to be added to the Unreleased section under the | ||
appropriate stanza (see below). Each entry should ideally include a tag and | ||
the Github issue reference in the following format: | ||
* (<tag>) \#<issue-number> message | ||
The issue numbers will later be link-ified during the release process so you do | ||
not have to worry about including a link manually, but you can if you wish. | ||
Types of changes (Stanzas): | ||
"Features" for new features. | ||
"Improvements" for changes in existing functionality. | ||
"Deprecated" for soon-to-be removed features. | ||
"Bug Fixes" for any bug fixes. | ||
"Client Breaking" for breaking Protobuf, gRPC and REST routes used by end-users. | ||
"CLI Breaking" for breaking CLI commands. | ||
"API Breaking" for breaking exported APIs used by developers building on SDK. | ||
Ref: https://keepachangelog.com/en/1.0.0/ | ||
--> | ||
|
||
# Changelog | ||
|
||
## [Unreleased] |
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,41 @@ | ||
# PostgreSQL Indexer | ||
|
||
The PostgreSQL indexer can fully index current state for all modules that | ||
implement `cosmossdk.io/schema.HasModuleCodec`. | ||
|
||
## Table, Column and Enum Naming | ||
|
||
`ObjectType`s names are converted to table names prefixed with the module name and an underscore. i.e. the `ObjectType` `foo` in module `bar` will be stored in a table named `bar_foo`. | ||
|
||
Column names are identical to field names. All identifiers are quoted with double quotes so that they are case-sensitive and won't clash with any reserved names. | ||
|
||
Like, table names, enum types are prefixed with the module name and an underscore. | ||
|
||
## Schema Type Mapping | ||
|
||
The mapping of `cosmossdk.io/schema` `Kind`s to PostgreSQL types is as follows: | ||
|
||
| Kind | PostgreSQL Type | Notes | | ||
|---------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `StringKind` | `TEXT` | | | ||
| `BoolKind` | `BOOLEAN` | | | ||
| `BytesKind` | `BYTEA` | | | ||
| `Int8Kind` | `SMALLINT` | | | ||
| `Int16Kind` | `SMALLINT` | | | ||
| `Int32Kind` | `INTEGER` | | | ||
| `Int64Kind` | `BIGINT` | | | ||
| `Uint8Kind` | `SMALLINT` | | | ||
| `Uint16Kind` | `INTEGER` | | | ||
| `Uint32Kind` | `BIGINT` | | | ||
| `Uint64Kind` | `NUMERIC` | | | ||
| `Float32Kind` | `REAL` | | | ||
| `Float64Kind` | `DOUBLE PRECISION` | | | ||
| `IntegerStringKind` | `NUMERIC` | | | ||
| `DecimalStringKind` | `NUMERIC` | | | ||
| `JSONKind` | `JSONB` | | | ||
| `Bech32AddressKind` | `TEXT` | addresses are converted to strings with the specified address prefix | | ||
| `TimeKind` | `BIGINT` and `TIMESTAMPTZ` | time types are stored as two columns, one with the `_nanos` suffix with full nano-seconds precision, and another as a `TIMESTAMPTZ` generated column with microsecond precision | | ||
| `DurationKind` | `BIGINT` | durations are stored as a single column in nanoseconds | | ||
| `EnumKind` | `<module_name>_<enum_name>` | a custom enum type is created for each module prefixed with with module name it pertains to | | ||
|
||
|
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,3 @@ | ||
# PostgreSQL Indexer Tests | ||
|
||
The majority of tests for the PostgreSQL indexer are stored in this separate `tests` go module to keep the main indexer module free of dependencies on any particular PostgreSQL driver. This allows users to choose their own driver and integrate the indexer free of any dependency conflict concerns. |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
indexer/postgres/testing/init_schema_test.go → indexer/postgres/tests/init_schema_test.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testing | ||
package tests | ||
|
||
import ( | ||
"context" | ||
|