@@ -2,8 +2,10 @@ import 'package:powersync/powersync.dart';
22import 'package:powersync_attachments_helper/powersync_attachments_helper.dart' ;
33
44const todosTable = 'todos' ;
5+ const listsRawTable = 'lists' ;
56
6- Schema schema = Schema (([
7+
8+ Schema schema = Schema ([
79 const Table (todosTable, [
810 Column .text ('list_id' ),
911 Column .text ('photo_id' ),
@@ -17,11 +19,30 @@ Schema schema = Schema(([
1719 // Index to allow efficient lookup within a list
1820 Index ('list' , [IndexedColumn ('list_id' )])
1921 ]),
20- const Table ('lists' , [
21- Column .text ('created_at' ),
22- Column .text ('name' ),
23- Column .text ('owner_id' )
24- ]),
22+ // const Table('lists', [
23+ // Column.text('created_at'),
24+ // Column.text('name'),
25+ // Column.text('owner_id')
26+ // ]),
2527 AttachmentsQueueTable (
26- attachmentsQueueTableName: defaultAttachmentsQueueTableName)
27- ]));
28+ attachmentsQueueTableName: defaultAttachmentsQueueTableName,
29+ ),
30+ ], rawTables: [
31+ RawTable (
32+ name: 'lists' ,
33+ put: PendingStatement (
34+ sql:
35+ "INSERT OR REPLACE INTO $listsRawTable (id, created_at, name, owner_id) VALUES (?, ?, ?, ?);" ,
36+ params: [
37+ PendingStmtValueId (),
38+ PendingStmtValueColumn ('created_at' ),
39+ PendingStmtValueColumn ('name' ),
40+ PendingStmtValueColumn ('owner_id' ),
41+ ],
42+ ),
43+ delete: PendingStatement (
44+ sql: "DELETE FROM $listsRawTable WHERE id = ?" ,
45+ params: [PendingStmtValueId ()],
46+ ),
47+ )
48+ ]);
0 commit comments