Skip to content

Commit

Permalink
allow schema edits if no original schema
Browse files Browse the repository at this point in the history
  • Loading branch information
wernst authored and pbohlman committed Jun 25, 2024
1 parent d7b2190 commit 150ad74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/console/src/utils/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ export async function safeSchemaEdit(
client: TriplitClient<any>,
callback: (tx: DBTransaction<any>) => Promise<void>
) {
const schema = await client.db.getSchema();
if (!schema) return;
const originalSchema = await client.db.getSchema();
return (
await client.transact(async (tx) => {
try {
await callback(tx);
if (!originalSchema) return;
const updatedSchema = await tx.getSchema();
if (!updatedSchema) return;
const diff = diffSchemas(schema!, updatedSchema);
const diff = diffSchemas(originalSchema, updatedSchema);

// If no differences, return early
if (diff.length === 0) return;
Expand Down

0 comments on commit 150ad74

Please sign in to comment.