-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppSchema.ts
More file actions
35 lines (29 loc) · 772 Bytes
/
AppSchema.ts
File metadata and controls
35 lines (29 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { column, Schema, Table } from "@powersync/node";
export const LISTS_TABLE = "lists";
export const TODOS_TABLE = "todos";
const todos = new Table(
{
list_id: column.text,
created_at: column.text,
completed_at: column.text,
description: column.text,
created_by: column.text,
completed_by: column.text,
completed: column.integer,
},
{ indexes: { list: ["list_id"] } },
);
const lists = new Table({
created_at: column.text,
name: column.text,
owner_id: column.text,
});
export const AppSchema = new Schema({
todos,
lists,
});
export type Database = (typeof AppSchema)["types"];
export type TodoRecord = Database["todos"];
// OR:
// export type Todo = RowType<typeof todos>;
export type ListRecord = Database["lists"];