Skip to content

Commit 119dc61

Browse files
committed
Try reproducing issue with raw tables
1 parent 1c904a8 commit 119dc61

File tree

4 files changed

+51
-28
lines changed

4 files changed

+51
-28
lines changed

demos/supabase-todolist/lib/models/schema.dart

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,39 @@ import 'package:powersync_core/attachments/attachments.dart';
33

44
const todosTable = 'todos';
55

6-
Schema schema = Schema([
7-
const Table(todosTable, [
8-
Column.text('list_id'),
9-
Column.text('photo_id'),
10-
Column.text('created_at'),
11-
Column.text('completed_at'),
12-
Column.text('description'),
13-
Column.integer('completed'),
14-
Column.text('created_by'),
15-
Column.text('completed_by'),
16-
], indexes: [
17-
// Index to allow efficient lookup within a list
18-
Index('list', [IndexedColumn('list_id')])
19-
]),
20-
const Table('lists', [
21-
Column.text('created_at'),
22-
Column.text('name'),
23-
Column.text('owner_id')
24-
]),
25-
AttachmentsQueueTable()
26-
]);
6+
Schema schema = Schema(
7+
[
8+
const Table(todosTable, [
9+
Column.text('list_id'),
10+
Column.text('photo_id'),
11+
Column.text('created_at'),
12+
Column.text('completed_at'),
13+
Column.text('description'),
14+
Column.integer('completed'),
15+
Column.text('created_by'),
16+
Column.text('completed_by'),
17+
], indexes: [
18+
// Index to allow efficient lookup within a list
19+
Index('list', [IndexedColumn('list_id')])
20+
]),
21+
AttachmentsQueueTable()
22+
],
23+
rawTables: [
24+
RawTable(
25+
name: 'lists',
26+
put: PendingStatement(
27+
sql:
28+
'INSERT OR REPLACE INTO lists (id, created_at, name, owner_id) VALUES (?, ?, ?, ?)',
29+
params: [
30+
PendingStatementValue.id(),
31+
PendingStatementValue.column('created_at'),
32+
PendingStatementValue.column('name'),
33+
PendingStatementValue.column('owner_id'),
34+
],
35+
),
36+
delete: PendingStatement(sql: 'DELETE FROM lists WHERE id = ?', params: [
37+
PendingStatementValue.id(),
38+
]),
39+
)
40+
],
41+
);

demos/supabase-todolist/lib/powersync.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ Future<void> openDatabase() async {
160160
db = PowerSyncDatabase(
161161
schema: schema, path: await getDatabasePath(), logger: attachedLogger);
162162
await db.initialize();
163+
await db.execute('''
164+
CREATE TABLE IF NOT EXISTS lists (
165+
id TEXT NOT NULL PRIMARY KEY,
166+
created_at TEXT,
167+
name TEXT,
168+
owner_id TEXT
169+
) STRICT;
170+
''');
163171

164172
await loadSupabase();
165173

@@ -190,7 +198,7 @@ Future<void> openDatabase() async {
190198

191199
// Demo using SQLite Full-Text Search with PowerSync.
192200
// See https://docs.powersync.com/usage-examples/full-text-search for more details
193-
await configureFts(db);
201+
//await configureFts(db);
194202
}
195203

196204
/// Explicit sign out - clear database and log out.

demos/supabase-todolist/pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,28 +566,28 @@ packages:
566566
path: "../../packages/powersync"
567567
relative: true
568568
source: path
569-
version: "1.15.2"
569+
version: "1.16.1"
570570
powersync_attachments_helper:
571571
dependency: "direct overridden"
572572
description:
573573
path: "../../packages/powersync_attachments_helper"
574574
relative: true
575575
source: path
576-
version: "0.6.19"
576+
version: "0.6.20"
577577
powersync_core:
578578
dependency: "direct main"
579579
description:
580580
path: "../../packages/powersync_core"
581581
relative: true
582582
source: path
583-
version: "1.5.2"
583+
version: "1.6.1"
584584
powersync_flutter_libs:
585585
dependency: "direct overridden"
586586
description:
587587
path: "../../packages/powersync_flutter_libs"
588588
relative: true
589589
source: path
590-
version: "0.4.11"
590+
version: "0.4.12"
591591
pub_semver:
592592
dependency: transitive
593593
description:

scripts/compile_webworker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Future<void> main() async {
2323
'js',
2424
'-o',
2525
dbWorkerOutputPath,
26-
'-O4',
26+
// '-O4',
2727
workerSourcePath,
2828
],
2929
workingDirectory: cwd);
@@ -47,7 +47,7 @@ Future<void> main() async {
4747
'js',
4848
'-o',
4949
syncWorkerOutputPath,
50-
'-O4',
50+
// '-O4',
5151
syncWorkerSourcePath,
5252
],
5353
workingDirectory: cwd);

0 commit comments

Comments
 (0)