pjfanning commented on code in PR #515:
URL: 
https://github.com/apache/pekko-persistence-r2dbc/pull/515#discussion_r4424451324


##########
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. I hit the same failure and pushed an equivalent fix as 0d343a2 
before I saw this: both specs sort the expected ids, and the "entity type after 
id" tests take the after id from that entity type's ids. It differs from 
0780dea only in naming and the comment. Checked with the `TestData` counter 
starting at 95: both specs failed before and pass after.



-- 
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]

Reply via email to