Skip to content

Commit 3068006

Browse files
committed
Improve time travel docs
1 parent 3306588 commit 3068006

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • apps/web/src/app/(docs)/docs/time-travel

apps/web/src/app/(docs)/docs/time-travel/page.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ By retaining all data, Evolu enables **time travel**. All mutations—including
1414
Here’s how to query the history of a specific column:
1515

1616
```ts
17-
const titleHistory = evolu.createQuery((db) =>
17+
const titleHistoryQuery = evolu.createQuery((db) =>
1818
db
1919
.selectFrom("evolu_history")
2020
.select(["value", "timestamp"])
@@ -27,14 +27,14 @@ const titleHistory = evolu.createQuery((db) =>
2727
);
2828

2929
const handleHistoryClick = () => {
30-
void evolu.loadQuery(titleHistory).then(({ rows }) => {
30+
void evolu.loadQuery(titleHistoryQuery).then((rows) => {
3131
const rowsWithTimestamp = rows.map((row) => ({
32-
...row,
33-
timestamp: timestampBytesToTimestamp(row.timestamp),
32+
value: row.value,
33+
timestamp: timestampToDateIso(timestampBytesToTimestamp(row.timestamp)),
3434
}));
3535
alert(JSON.stringify(rowsWithTimestamp, null, 2));
3636
});
3737
};
3838
```
3939

40-
This API isn’t fully type-safe, but it’s not a concern. Evolu Schemas are append-only. Once an app is released, you should not rename or change existing table or column types. Only new tables and columns should be added to avoid breaking compatibility with existing data.
40+
This API isn’t fully type-safe, but it’s not a concern. Evolu Schemas are append-only. Once an app is released, do not rename or change the type of an existing table or column — only add new tables or columns to evolve your schema; changing existing columns or types breaks compatibility with historical data.

0 commit comments

Comments
 (0)