@@ -15,7 +15,7 @@ import { wrapPowerSyncWithDrizzle } from '@powersync/drizzle-driver';
1515import { PowerSyncDatabase } from ' @powersync/web' ;
1616import { relations } from ' drizzle-orm' ;
1717import { index , integer , sqliteTable , text } from ' drizzle-orm/sqlite-core' ;
18- import { appSchema } from ' ./schema' ;
18+ import { AppSchema } from ' ./schema' ;
1919
2020export const lists = sqliteTable (' lists' , {
2121 id: text (' id' ),
@@ -47,22 +47,24 @@ export const drizzleSchema = {
4747 todosRelations
4848};
4949
50+ // As an alternative to manually defining a PowerSync schema, generate the local PowerSync schema from the Drizzle schema with `toPowerSyncSchema`:
51+ // import { toPowerSyncSchema } from '@powersync/drizzle-driver';
52+ // export const AppSchema = toPowerSyncSchema(drizzleSchema);
53+ //
54+ // This is optional, but recommended, since you will only need to maintain one schema on the client-side
55+ // Read on to learn more.
56+
5057export const powerSyncDb = new PowerSyncDatabase ({
5158 database: {
5259 dbFilename: ' test.sqlite'
5360 },
54- schema: appSchema
61+ schema: AppSchema
5562});
5663
5764// This is the DB you will use in queries
5865export const db = wrapPowerSyncWithDrizzle (powerSyncDb, {
5966 schema: drizzleSchema
6067});
61-
62- // Generate the local PowerSync schema from the Drizzle schema with `toPowerSyncSchema`
63- // Optional, but recommended, since you will only need to maintain one schema on the client-side
64- // Read on to learn more.
65- export const AppSchema = toPowerSyncSchema (drizzleSchema);
6668```
6769
6870## Schema Conversion
0 commit comments