Skip to content

Releases: streamingfast/substreams-sink-database-changes

v4.0.0

27 Jan 20:42

Choose a tag to compare

  • 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::v1 package has been deprecated, use the full name like any other Protobuf packages we usually provide and which is now at `crate::pb::sf

    Usually migrating is a single matter of a search/replace across your codebase:

    • Replace all substreams_database_change::pb::database:: by substreams_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

06 Nov 15:48

Choose a tag to compare

  • Bump substreams to 0.7.0

v2.1.1

02 Jun 13:46

Choose a tag to compare

  • Fixed Tables abstraction not respecting ordering of operations leading to foreign constraints to often fail because executed out of order.

v2.1.0

16 May 21:13

Choose a tag to compare

  • Added support for upsert_row in the Tables abstraction, allowing upsert (insert or update) operations on rows. This requires a development version of substreams-sink-sql to operate correctly.

    For usage and reference, see the Table Operations section in the documentation.

v2.0.0

16 Oct 19:24

Choose a tag to compare

  • Bumped dependencies to substreams to 0.6 and prost to 0.13 (see Upgrade notes)

v1.3.1

30 Jan 20:21

Choose a tag to compare

Maintenance release introducing experimental hidden methods to deal with arrays.

v1.3.0

31 Oct 19:59

Choose a tag to compare

Better support for using composite primary keys:

  • New enum in this crate: tables::PrimaryKey
    • Single(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.pks field is not public anymore.
  • create_row(), update_row() and delete_row() now require a PrimaryKey instead of a String. This should work directly with a String, &String or &str.

v1.2.1

13 Jul 17:47

Choose a tag to compare

  • Changed imports in substreams.yaml definition so that packaged .spkg can you the expect path sf/substreams/sink/database/v1 to exclude and generating from the .spkg will 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

28 Jun 18:29

Choose a tag to compare

  • Breaking Renamed substreams_database_change::pb::database::table_change::Operation::Unset to be become ...::Operation::Unspecified to 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.

v1.1.3

09 Jun 18:28

Choose a tag to compare

  • Removed some useless dependencies.