@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.
|
@@ -15587,16 +15587,21 @@ class TriggerManagerImpl {
|
|
|
15587
15587
|
}
|
|
15588
15588
|
});
|
|
15589
15589
|
}
|
|
15590
|
-
/**
|
|
15591
|
-
* Creates a diff trigger destination table on the database with the given configuration.
|
|
15592
|
-
* By default this is invoked internally when creating a diff trigger, but can
|
|
15593
|
-
* be used manually if `manageDestinationExternally` is set to true.
|
|
15594
|
-
*/
|
|
15595
15590
|
async createDiffDestinationTable(tableName, options) {
|
|
15596
|
-
const tableTriggerTypeClause =
|
|
15591
|
+
const tableTriggerTypeClause = options?.temporary ? 'TEMP' : '';
|
|
15597
15592
|
const onlyIfNotExists = options?.onlyIfNotExists ? 'IF NOT EXISTS' : '';
|
|
15598
|
-
|
|
15599
|
-
|
|
15593
|
+
let x = `
|
|
15594
|
+
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
15595
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15596
|
+
id TEXT,
|
|
15597
|
+
operation TEXT,
|
|
15598
|
+
timestamp TEXT,
|
|
15599
|
+
value TEXT,
|
|
15600
|
+
previous_value TEXT
|
|
15601
|
+
)
|
|
15602
|
+
`;
|
|
15603
|
+
console.log(x);
|
|
15604
|
+
await this.db.execute(/* sql */ `
|
|
15600
15605
|
CREATE ${tableTriggerTypeClause} TABLE ${onlyIfNotExists} ${tableName} (
|
|
15601
15606
|
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15602
15607
|
id TEXT,
|
|
@@ -15678,11 +15683,16 @@ class TriggerManagerImpl {
|
|
|
15678
15683
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
15679
15684
|
await hooks?.beforeCreate?.(tx);
|
|
15680
15685
|
if (!manageDestinationExternally) {
|
|
15681
|
-
await
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
+
await tx.execute(/* sql */ `
|
|
15687
|
+
CREATE ${tableTriggerTypeClause} TABLE ${destination} (
|
|
15688
|
+
operation_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15689
|
+
id TEXT,
|
|
15690
|
+
operation TEXT,
|
|
15691
|
+
timestamp TEXT,
|
|
15692
|
+
value TEXT,
|
|
15693
|
+
previous_value TEXT
|
|
15694
|
+
)
|
|
15695
|
+
`);
|
|
15686
15696
|
}
|
|
15687
15697
|
if (operations.includes(DiffTriggerOperation.INSERT)) {
|
|
15688
15698
|
const insertTriggerId = this.generateTriggerName(DiffTriggerOperation.INSERT, destination, id, manageDestinationExternally);
|