Skip to content

Commit 5d9eb7c

Browse files
Add missing TypeScript example in migration guide (#4508)
The 'Option 2: overwrite the name of individual tables' section of the 2.0 migration guide had an empty TypeScript tab. Adds a complete example using `table()` with an explicit `name` property to preserve the pre-conversion table name. Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
1 parent efa6f38 commit 5d9eb7c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

docs/docs/00300-resources/00100-how-to/00600-migrating-to-2.0.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,23 @@ Alternatively, manually specify the correct canonical name of each table:
651651
<Tabs groupId="server-language" queryString>
652652
<TabItem value="typescript" label="TypeScript">
653653

654+
```typescript
655+
import { table, schema, t } from 'spacetimedb/server';
656+
657+
const myTable = table(
658+
{
659+
name: 'MyTable',
660+
public: true,
661+
indexes: [{ accessor: 'position', columns: ['x', 'y'] }],
662+
},
663+
{
664+
id: t.u32().primaryKey().autoInc(),
665+
x: t.u32(),
666+
y: t.u32(),
667+
}
668+
);
669+
```
670+
654671
</TabItem>
655672
<TabItem value="csharp" label="C#">
656673

0 commit comments

Comments
 (0)