@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.
@@ -9965,16 +9965,21 @@ class TriggerManagerImpl {
9965
9965
  }
9966
9966
  });
9967
9967
  }
9968
- /**
9969
- * Creates a diff trigger destination table on the database with the given configuration.
9970
- * By default this is invoked internally when creating a diff trigger, but can
9971
- * be used manually if `manageDestinationExternally` is set to true.
9972
- */
9973
9968
  async createDiffDestinationTable(tableName, options) {
9974
- const tableTriggerTypeClause = !options?.useStorage ? 'TEMP' : '';
9969
+ const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
9975
9970
  const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
9976
- const ctx = options?.lockContext ?? this.db.database;
9977
- await ctx.execute(/* sql */ `
9971
+ let x = `
9972
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
9973
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
9974
+ id TEXT,
9975
+ operation TEXT,
9976
+ timestamp TEXT,
9977
+ value TEXT,
9978
+ previous_value TEXT
9979
+ )
9980
+ `;
9981
+ console.log(x);
9982
+ await this.db.execute(/* sql */ `
9978
9983
  CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
9979
9984
  operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
9980
9985
  id TEXT,
@@ -10056,11 +10061,16 @@ class TriggerManagerImpl {
10056
10061
  // Allow user code to execute in this lock context before the trigger is created.
10057
10062
  await hooks?.beforeCreate?.(tx);
10058
10063
  if (!manageDestinationExternally) {
10059
- await this.createDiffDestinationTable(destination, {
10060
- lockContext: tx,
10061
- useStorage,
10062
- onlyIfNotExists: false
10063
- });
10064
+ await tx.execute(/* sql */ `
10065
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
10066
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
10067
+ id TEXT,
10068
+ operation TEXT,
10069
+ timestamp TEXT,
10070
+ value TEXT,
10071
+ previous_value TEXT
10072
+ )
10073
+ `);
10064
10074
  }
10065
10075
  if (operations.includes(DiffTriggerOperation.INSERT)) {
10066
10076
  const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);