Releases: streamingfast/substreams-sink-database-changes
v4.0.0
-
Add support for delta update operations (
add/sub/min/max/set_if_null) on rows:tables.upsert_row("Account", id) .set("owner", owner) .add("balance", 100i64) // column = COALESCE(column, 0) + 100 .sub("debt", 50i64) // column = COALESCE(column, 0) - 50 .max("high_score", score) // column = GREATEST(column, score) .min("best_time", duration) // column = LEAST(column, duration) .set_if_null("created_at", timestamp); // column = COALESCE(column, timestamp)
Requires latest substreams-sink-sql version for this to be supported correctly.
Deprecations
-
The
crate::pb::sf::substreams::sink::database::v1package has been deprecated, use the full name like any other Protobuf packages we usually provide and which is now at `crate::pb::sfUsually migrating is a single matter of a search/replace across your codebase:
-
Replace all
substreams_database_change::pb::database::bysubstreams_database_change::pb::sf::substreams::sink::database::v1::So for example this code:
use substreams_database_change::pb::database::{ field::UpdateOp, table_change::Operation, DatabaseChanges, Field, TableChange, };
Should become:
use substreams_database_change::pb::sf::substreams::sink::database::v1::{ field::UpdateOp, table_change::Operation, DatabaseChanges, Field, TableChange, };
-
v3.0.0
v2.1.1
v2.1.0
-
Added support for
upsert_rowin theTablesabstraction, allowing upsert (insert or update) operations on rows. This requires a development version ofsubstreams-sink-sqlto operate correctly.For usage and reference, see the Table Operations section in the documentation.
v2.0.0
- Bumped dependencies to
substreamsto 0.6 andprostto 0.13 (see Upgrade notes)
v1.3.1
v1.3.0
Better support for using composite primary keys:
- New enum in this crate:
tables::PrimaryKeySingle(String):let single: PrimaryKey = "hello world".into()Composite(BTreeMap<String, String>):let composite: PrimaryKey = [("evt_tx_hash","hello".to_string()),("evt_index","world".to_string())].into()
Breaking changes:
- The
Rows.pksfield is not public anymore. create_row(),update_row()anddelete_row()now require aPrimaryKeyinstead of aString. This should work directly with aString,&Stringor&str.
v1.2.1
- Changed imports in
substreams.yamldefinition so that packaged.spkgcan you the expect pathsf/substreams/sink/database/v1to exclude and generating from the.spkgwill generate data on the right path.
If you were using --exclude-paths on substreams protogen and your path was database.proto, you should change to sf/substreams/sink/database/v1. We think this affects no one has everyone is probably using the pre-rendered Protobuf found in Rust crate substreams-database-change.
v1.2.0
-
Breaking Renamed
substreams_database_change::pb::database::table_change::Operation::Unsetto be become...::Operation::Unspecifiedto make the Protobuf conforms to buf lint rules.We take the liberty to change it because we expect that almost everyone is using the abstraction provided by this library.