@powersync/web 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.
@@ -16971,16 +16971,21 @@ class TriggerManagerImpl {
16971
16971
  }
16972
16972
  });
16973
16973
  }
16974
- /**
16975
- * Creates a diff trigger destination table on the database with the given configuration.
16976
- * By default this is invoked internally when creating a diff trigger, but can
16977
- * be used manually if `manageDestinationExternally` is set to true.
16978
- */
16979
16974
  async createDiffDestinationTable(tableName, options) {
16980
- const tableTriggerTypeClause = !options?.useStorage ? 'TEMP' : '';
16975
+ const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
16981
16976
  const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
16982
- const ctx = options?.lockContext ?? this.db.database;
16983
- await ctx.execute(/* sql */ `
16977
+ let x = `
16978
+ CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
16979
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
16980
+ id TEXT,
16981
+ operation TEXT,
16982
+ timestamp TEXT,
16983
+ value TEXT,
16984
+ previous_value TEXT
16985
+ )
16986
+ `;
16987
+ console.log(x);
16988
+ await this.db.execute(/* sql */ `
16984
16989
  CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
16985
16990
  operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
16986
16991
  id TEXT,
@@ -17062,11 +17067,16 @@ class TriggerManagerImpl {
17062
17067
  // Allow user code to execute in this lock context before the trigger is created.
17063
17068
  await hooks?.beforeCreate?.(tx);
17064
17069
  if (!manageDestinationExternally) {
17065
- await this.createDiffDestinationTable(destination, {
17066
- lockContext: tx,
17067
- useStorage,
17068
- onlyIfNotExists: false
17069
- });
17070
+ await tx.execute(/* sql */ `
17071
+ CREATE ${tableTriggerTypeClause} TABLE ${destination} (
17072
+ operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
17073
+ id TEXT,
17074
+ operation TEXT,
17075
+ timestamp TEXT,
17076
+ value TEXT,
17077
+ previous_value TEXT
17078
+ )
17079
+ `);
17070
17080
  }
17071
17081
  if (operations.includes(DiffTriggerOperation.INSERT)) {
17072
17082
  const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);