Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
benitav committed Nov 21, 2024
1 parent b3882ac commit 31759b7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/drizzle-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { wrapPowerSyncWithDrizzle } from '@powersync/drizzle-driver';
import { PowerSyncDatabase } from '@powersync/web';
import { relations } from 'drizzle-orm';
import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { appSchema } from './schema';
import { AppSchema } from './schema';

export const lists = sqliteTable('lists', {
id: text('id'),
Expand Down Expand Up @@ -47,22 +47,24 @@ export const drizzleSchema = {
todosRelations
};

// As an alternative to manually defining a PowerSync schema, generate the local PowerSync schema from the Drizzle schema with `toPowerSyncSchema`:
// import { toPowerSyncSchema } from '@powersync/drizzle-driver';
// export const AppSchema = toPowerSyncSchema(drizzleSchema);
//
// This is optional, but recommended, since you will only need to maintain one schema on the client-side
// Read on to learn more.

export const powerSyncDb = new PowerSyncDatabase({
database: {
dbFilename: 'test.sqlite'
},
schema: appSchema
schema: AppSchema
});

// This is the DB you will use in queries
export const db = wrapPowerSyncWithDrizzle(powerSyncDb, {
schema: drizzleSchema
});

// Generate the local PowerSync schema from the Drizzle schema with `toPowerSyncSchema`
// Optional, but recommended, since you will only need to maintain one schema on the client-side
// Read on to learn more.
export const AppSchema = toPowerSyncSchema(drizzleSchema);
```

## Schema Conversion
Expand Down

0 comments on commit 31759b7

Please sign in to comment.