@powersync/common 0.0.0-dev-20260306114652 → 0.0.0-dev-20260306125455

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.mjs CHANGED
@@ -12487,16 +12487,21 @@ class TriggerManagerImpl {
12487
12487
  }
12488
12488
  });
12489
12489
  }
12490
- /**
12491
- * Creates a diff trigger destination table on the database with the given configuration.
12492
- * By default this is invoked internally when creating a diff trigger, but can
12493
- * be used manually if `manageDestinationExternally` is set to true.
12494
- */
12495
12490
  async createDiffDestinationTable(tableName, options) {
12496
- const tableTriggerTypeClause = !options?.useStorage ? 'TEMP' : '';
12491
+ const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
12497
12492
  const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
12498
- const ctx = options?.lockContext ?? this.db.database;
12499
- await ctx.execute(/* sql */ `
12493
+ let x = `
12494
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
12495
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12496
+ id TEXT,
12497
+ operation TEXT,
12498
+ timestamp TEXT,
12499
+ value TEXT,
12500
+ previous_value TEXT
12501
+ )
12502
+ `;
12503
+ console.log(x);
12504
+ await this.db.execute(/* sql */ `
12500
12505
  CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
12501
12506
  operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12502
12507
  id TEXT,
@@ -12578,11 +12583,16 @@ class TriggerManagerImpl {
12578
12583
  // Allow user code to execute in this lock context before the trigger is created.
12579
12584
  await hooks?.beforeCreate?.(tx);
12580
12585
  if (!manageDestinationExternally) {
12581
- await this.createDiffDestinationTable(destination, {
12582
- lockContext: tx,
12583
- useStorage,
12584
- onlyIfNotExists: false
12585
- });
12586
+ await tx.execute(/* sql */ `
12587
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
12588
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12589
+ id TEXT,
12590
+ operation TEXT,
12591
+ timestamp TEXT,
12592
+ value TEXT,
12593
+ previous_value TEXT
12594
+ )
12595
+ `);
12586
12596
  }
12587
12597
  if (operations.includes(DiffTriggerOperation.INSERT)) {
12588
12598
  const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);