@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.cjs CHANGED
@@ -12489,16 +12489,21 @@ class TriggerManagerImpl {
12489
12489
  }
12490
12490
  });
12491
12491
  }
12492
- /**
12493
- * Creates a diff trigger destination table on the database with the given configuration.
12494
- * By default this is invoked internally when creating a diff trigger, but can
12495
- * be used manually if `manageDestinationExternally` is set to true.
12496
- */
12497
12492
  async createDiffDestinationTable(tableName, options) {
12498
- const tableTriggerTypeClause = !options?.useStorage ? 'TEMP' : '';
12493
+ const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
12499
12494
  const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
12500
- const ctx = options?.lockContext ?? this.db.database;
12501
- await ctx.execute(/* sql */ `
12495
+ let x = `
12496
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
12497
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12498
+ id TEXT,
12499
+ operation TEXT,
12500
+ timestamp TEXT,
12501
+ value TEXT,
12502
+ previous_value TEXT
12503
+ )
12504
+ `;
12505
+ console.log(x);
12506
+ await this.db.execute(/* sql */ `
12502
12507
  CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
12503
12508
  operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12504
12509
  id TEXT,
@@ -12580,11 +12585,16 @@ class TriggerManagerImpl {
12580
12585
  // Allow user code to execute in this lock context before the trigger is created.
12581
12586
  await hooks?.beforeCreate?.(tx);
12582
12587
  if (!manageDestinationExternally) {
12583
- await this.createDiffDestinationTable(destination, {
12584
- lockContext: tx,
12585
- useStorage,
12586
- onlyIfNotExists: false
12587
- });
12588
+ await tx.execute(/* sql */ `
12589
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
12590
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
12591
+ id TEXT,
12592
+ operation TEXT,
12593
+ timestamp TEXT,
12594
+ value TEXT,
12595
+ previous_value TEXT
12596
+ )
12597
+ `);
12588
12598
  }
12589
12599
  if (operations.includes(exports.DiffTriggerOperation.INSERT)) {
12590
12600
  const insertTriggerId = this.generateTriggerName(exports.DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);