pjfanning commented on code in PR #515: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/515#discussion_r4423459486
########## ddl-scripts/migration/snapshot_start_from_snapshot_postgres.sql: ########## @@ -0,0 +1,13 @@ +-- Adds the snapshot columns and index that are needed by the queries that use snapshots as starting points +-- (eventsBySlicesStartingFromSnapshots, eventsByPersistenceIdStartingFromSnapshot and their current variants). +-- Use this for both the BYTEA and the JSONB schema. See the migration guide for a rolling update procedure. + +ALTER TABLE snapshot ADD COLUMN IF NOT EXISTS db_timestamp timestamp with time zone; +ALTER TABLE snapshot ADD COLUMN IF NOT EXISTS tags TEXT ARRAY; + +-- populate the new columns from the corresponding events +UPDATE snapshot s SET db_timestamp = e.db_timestamp, tags = e.tags + FROM event_journal e + WHERE s.persistence_id = e.persistence_id AND s.seq_nr = e.seq_nr; Review Comment: Thanks, cherry-picked as fea472e (plus a scalafmt line wrap in the new spec). The fallback matches what `saveAsync` and the `MigrationTool` do, and the spec covers both delete cases. On H2 it's cancelled as expected; CI will run it on the other databases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
