You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test("backfills projected Session message order from durable event sequence",async()=>{
82
+
test("resets incompatible projected Session messages before adding sequence order",async()=>{
83
83
awaitrun(
84
84
Effect.gen(function*(){
85
85
constdb=yield*makeDb
86
+
yield*db.run(sql`CREATE TABLE session (id text PRIMARY KEY)`)
87
+
yield*db.run(
88
+
sql`CREATE TABLE message (id text PRIMARY KEY, session_id text NOT NULL, time_created integer NOT NULL, time_updated integer NOT NULL, data text NOT NULL)`,
89
+
)
90
+
yield*db.run(
91
+
sql`CREATE TABLE part (id text PRIMARY KEY, message_id text NOT NULL, session_id text NOT NULL, time_created integer NOT NULL, time_updated integer NOT NULL, data text NOT NULL)`,
92
+
)
86
93
yield*db.run(sql`CREATE TABLE event (id text PRIMARY KEY, seq integer NOT NULL)`)
87
94
yield*db.run(
88
-
sql`CREATE TABLE session_message (id text PRIMARY KEY, session_id text NOT NULL, type text NOT NULL, time_created integer NOT NULL, data text NOT NULL)`,
95
+
sql`CREATE TABLE session_message (id text PRIMARY KEY, session_id text NOT NULL, type text NOT NULL, time_created integer NOT NULL, time_updated integer NOT NULL, data text NOT NULL)`,
89
96
)
90
97
yield*db.run(
91
98
sql`CREATE INDEX session_message_session_time_created_id_idx ON session_message (session_id, time_created, id)`,
92
99
)
93
100
yield*db.run(
94
101
sql`CREATE INDEX session_message_session_type_time_created_id_idx ON session_message (session_id, type, time_created, id)`,
95
102
)
96
-
yield*db.run(sql`INSERT INTO event (id, seq) VALUES ('evt_z', 0), ('evt_a', 1)`)
103
+
yield*db.run(sql`INSERT INTO session (id) VALUES ('session')`)
expect(yield*db.get(sql`SELECT id, seq FROM session_message`)).toEqual({id: "fresh_projection",seq: 7})
107
133
}),
108
134
)
109
135
})
110
136
111
-
test("fails projected Session message order backfill without a durable event",async()=>{
112
-
awaitexpect(
113
-
run(
114
-
Effect.gen(function*(){
115
-
constdb=yield*makeDb
116
-
yield*db.run(sql`CREATE TABLE event (id text PRIMARY KEY, seq integer NOT NULL)`)
117
-
yield*db.run(
118
-
sql`CREATE TABLE session_message (id text PRIMARY KEY, session_id text NOT NULL, type text NOT NULL, time_created integer NOT NULL, data text NOT NULL)`,
0 commit comments