Default mode for PostgreSQL
Use default mode to store a list of immutable entries into a PostgreSQL table.
Usage
In default mode, the transform function must return a list of rows that will be inserted into the PostgreSQL table.
In this mode, the only required options
are tableName
and connectionString
.
Table schema
Apibara requires the target table to have a _cursor bigint
column. This column
is used to track at which block a row is inserted to handle chain
reorganizations.
create table yourtable(
-- your columns here
_cursor bigint
)
Indices
For better performance, you should add an index on the _cursor
column.
This index is used by the indexer when updating data between pending blocks.
CREATE INDEX ON yourtable (_cursor);