@powersync/service-module-postgres-storage 0.0.0-dev-20260803144812 → 0.0.0-dev-20260929095716
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/CHANGELOG.md +125 -8
- package/dist/migrations/scripts/1784900000000-source-metadata.d.ts +3 -0
- package/dist/migrations/scripts/1784900000000-source-metadata.js +22 -0
- package/dist/migrations/scripts/1784900000000-source-metadata.js.map +1 -0
- package/dist/migrations/scripts/1788000000000-sync-config-version-label.d.ts +3 -0
- package/dist/migrations/scripts/1788000000000-sync-config-version-label.js +12 -0
- package/dist/migrations/scripts/1788000000000-sync-config-version-label.js.map +1 -0
- package/dist/storage/PostgresBucketStorageFactory.d.ts +2 -1
- package/dist/storage/PostgresBucketStorageFactory.js +27 -14
- package/dist/storage/PostgresBucketStorageFactory.js.map +1 -1
- package/dist/storage/PostgresStorageProvider.js +3 -2
- package/dist/storage/PostgresStorageProvider.js.map +1 -1
- package/dist/storage/PostgresSyncRulesStorage.d.ts +4 -3
- package/dist/storage/PostgresSyncRulesStorage.js +17 -5
- package/dist/storage/PostgresSyncRulesStorage.js.map +1 -1
- package/dist/storage/batch/PostgresBucketBatch.d.ts +2 -2
- package/dist/storage/batch/PostgresBucketBatch.js +63 -94
- package/dist/storage/batch/PostgresBucketBatch.js.map +1 -1
- package/dist/storage/checkpoints/PostgresWriteCheckpointAPI.d.ts +1 -1
- package/dist/storage/checkpoints/PostgresWriteCheckpointAPI.js +2 -2
- package/dist/storage/checkpoints/PostgresWriteCheckpointAPI.js.map +1 -1
- package/dist/storage/sync-rules/PostgresPersistedSyncConfigContent.d.ts +3 -2
- package/dist/storage/sync-rules/PostgresPersistedSyncConfigContent.js +12 -5
- package/dist/storage/sync-rules/PostgresPersistedSyncConfigContent.js.map +1 -1
- package/dist/types/models/ActiveCheckpoint.d.ts +2 -2
- package/dist/types/models/ActiveCheckpoint.js +3 -2
- package/dist/types/models/ActiveCheckpoint.js.map +1 -1
- package/dist/types/models/ActiveCheckpointNotification.d.ts +2 -2
- package/dist/types/models/BucketData.d.ts +6 -6
- package/dist/types/models/BucketData.js +7 -6
- package/dist/types/models/BucketData.js.map +1 -1
- package/dist/types/models/CurrentData.d.ts +1 -1
- package/dist/types/models/CurrentData.js +2 -1
- package/dist/types/models/CurrentData.js.map +1 -1
- package/dist/types/models/SdkReporting.d.ts +3 -3
- package/dist/types/models/SdkReporting.js +3 -5
- package/dist/types/models/SdkReporting.js.map +1 -1
- package/dist/types/models/SourceTable.d.ts +13 -8
- package/dist/types/models/SourceTable.js +11 -6
- package/dist/types/models/SourceTable.js.map +1 -1
- package/dist/types/models/SyncRules.d.ts +11 -10
- package/dist/types/models/SyncRules.js +12 -11
- package/dist/types/models/SyncRules.js.map +1 -1
- package/dist/types/models/WriteCheckpoint.d.ts +2 -2
- package/dist/types/models/WriteCheckpoint.js +3 -2
- package/dist/types/models/WriteCheckpoint.js.map +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/utils/test-utils.d.ts +2 -1
- package/dist/utils/test-utils.js +3 -3
- package/dist/utils/test-utils.js.map +1 -1
- package/package.json +8 -8
- package/src/migrations/scripts/1784900000000-source-metadata.ts +31 -0
- package/src/migrations/scripts/1788000000000-sync-config-version-label.ts +18 -0
- package/src/storage/PostgresBucketStorageFactory.ts +30 -14
- package/src/storage/PostgresStorageProvider.ts +9 -5
- package/src/storage/PostgresSyncRulesStorage.ts +21 -6
- package/src/storage/batch/PostgresBucketBatch.ts +67 -98
- package/src/storage/checkpoints/PostgresWriteCheckpointAPI.ts +2 -2
- package/src/storage/sync-rules/PostgresPersistedSyncConfigContent.ts +24 -11
- package/src/types/models/ActiveCheckpoint.ts +3 -2
- package/src/types/models/BucketData.ts +7 -6
- package/src/types/models/CurrentData.ts +2 -1
- package/src/types/models/SdkReporting.ts +4 -4
- package/src/types/models/SourceTable.ts +12 -6
- package/src/types/models/SyncRules.ts +12 -11
- package/src/types/models/WriteCheckpoint.ts +3 -2
- package/src/utils/test-utils.ts +23 -9
- package/test/src/__snapshots__/storage_sync.test.ts.snap +0 -995
- package/test/src/checkpoint_notifications.test.ts +8 -2
- package/test/src/migrations.test.ts +8 -4
- package/test/src/storage.test.ts +12 -4
- package/test/src/storage_compacting.test.ts +2 -2
- package/test/src/storage_sync.test.ts +44 -0
- package/test/src/util.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { orNull } from '@powersync/service-types';
|
|
1
2
|
import * as t from 'ts-codec';
|
|
2
3
|
import { bigint, hexBuffer, pgwire_number } from '../codecs.js';
|
|
3
4
|
export var OpType;
|
|
@@ -12,12 +13,12 @@ export const BucketData = t.object({
|
|
|
12
13
|
bucket_name: t.string,
|
|
13
14
|
op_id: bigint,
|
|
14
15
|
op: t.Enum(OpType),
|
|
15
|
-
source_table:
|
|
16
|
-
source_key:
|
|
17
|
-
table_name: t.string
|
|
18
|
-
row_id: t.string
|
|
16
|
+
source_table: orNull(t.string),
|
|
17
|
+
source_key: orNull(hexBuffer),
|
|
18
|
+
table_name: orNull(t.string),
|
|
19
|
+
row_id: orNull(t.string),
|
|
19
20
|
checksum: bigint,
|
|
20
|
-
data:
|
|
21
|
-
target_op:
|
|
21
|
+
data: orNull(t.string),
|
|
22
|
+
target_op: orNull(bigint)
|
|
22
23
|
});
|
|
23
24
|
//# sourceMappingURL=BucketData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BucketData.js","sourceRoot":"","sources":["../../../src/types/models/BucketData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,CAAN,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,qBAAW,CAAA;IACX,2BAAiB,CAAA;IACjB,uBAAa,CAAA;IACb,yBAAe,CAAA;AACjB,CAAC,EAL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export declare const V3CurrentData: t.ObjectCodec<{
|
|
|
29
29
|
lookups: t.ArrayCodec<t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>>;
|
|
30
30
|
source_key: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
31
31
|
source_table: t.IdentityCodec<t.CodecType.String>;
|
|
32
|
-
pending_delete: t.
|
|
32
|
+
pending_delete: t.Codec<bigint | null, string | number | null>;
|
|
33
33
|
}>;
|
|
34
34
|
export type V1CurrentData = t.Encoded<typeof V1CurrentData>;
|
|
35
35
|
export type V1CurrentDataDecoded = t.Decoded<typeof V1CurrentData>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { orNull } from '@powersync/service-types';
|
|
1
2
|
import * as t from 'ts-codec';
|
|
2
3
|
import { bigint, hexBuffer, jsonb, pgwire_number } from '../codecs.js';
|
|
3
4
|
export const CurrentBucket = t.object({
|
|
@@ -20,6 +21,6 @@ export const V3CurrentData = t.object({
|
|
|
20
21
|
lookups: t.array(hexBuffer),
|
|
21
22
|
source_key: hexBuffer,
|
|
22
23
|
source_table: t.string,
|
|
23
|
-
pending_delete:
|
|
24
|
+
pending_delete: orNull(bigint)
|
|
24
25
|
});
|
|
25
26
|
//# sourceMappingURL=CurrentData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentData.js","sourceRoot":"","sources":["../../../src/types/models/CurrentData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,EAAE,EAAE,CAAC,CAAC,MAAM;CACb,CAAC,CAAC;AAKH,M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QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACtC,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC;CAC/B,CAAC,CAAC"}
|
|
@@ -7,15 +7,15 @@ export declare const Sdks: t.ObjectCodec<{
|
|
|
7
7
|
export type Sdks = t.Encoded<typeof Sdks>;
|
|
8
8
|
export declare const SdkReporting: t.ObjectCodec<{
|
|
9
9
|
users: t.Codec<bigint, string | number, string, t.CodecProps>;
|
|
10
|
-
sdks: t.
|
|
10
|
+
sdks: t.OptionalCodec<t.Codec<{
|
|
11
11
|
data: {
|
|
12
12
|
sdk: string;
|
|
13
13
|
clients: number;
|
|
14
14
|
users: number;
|
|
15
15
|
}[];
|
|
16
|
-
} |
|
|
16
|
+
} | null, {
|
|
17
17
|
data: string;
|
|
18
|
-
} |
|
|
18
|
+
} | null, string, t.CodecProps>>;
|
|
19
19
|
}>;
|
|
20
20
|
export type SdkReporting = t.Encoded<typeof SdkReporting>;
|
|
21
21
|
export type SdkReportingDecoded = t.Decoded<typeof SdkReporting>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { orNull } from '@powersync/service-types';
|
|
1
2
|
import * as t from 'ts-codec';
|
|
2
3
|
import { bigint, jsonb } from '../codecs.js';
|
|
3
4
|
export const Sdks = t.object({
|
|
@@ -7,11 +8,8 @@ export const Sdks = t.object({
|
|
|
7
8
|
});
|
|
8
9
|
export const SdkReporting = t.object({
|
|
9
10
|
users: bigint,
|
|
10
|
-
sdks: t
|
|
11
|
-
.object({
|
|
11
|
+
sdks: orNull(t.object({
|
|
12
12
|
data: jsonb(t.array(Sdks))
|
|
13
|
-
})
|
|
14
|
-
.optional()
|
|
15
|
-
.or(t.Null)
|
|
13
|
+
})).optional()
|
|
16
14
|
});
|
|
17
15
|
//# sourceMappingURL=SdkReporting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SdkReporting.js","sourceRoot":"","sources":["../../../src/types/models/SdkReporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM;IACb,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM;CAChB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"SdkReporting.js","sourceRoot":"","sources":["../../../src/types/models/SdkReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM;IACb,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM;CAChB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM,CACV,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,KAAK,CAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACnC,CAAC,CACH,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsonValue } from '@powersync/service-core';
|
|
1
2
|
import * as t from 'ts-codec';
|
|
2
3
|
export type StoredRelationId = {
|
|
3
4
|
object_id: string | number | undefined;
|
|
@@ -11,24 +12,28 @@ export declare const ColumnDescriptor: t.ObjectCodec<{
|
|
|
11
12
|
/**
|
|
12
13
|
* Some data sources have a type id that can be used to identify the type of the column
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
type_oid: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
|
|
15
16
|
}>;
|
|
16
17
|
export declare const SourceTable: t.ObjectCodec<{
|
|
17
18
|
id: t.IdentityCodec<t.CodecType.String>;
|
|
18
19
|
group_id: t.Codec<number, number, "pg_number", t.CodecProps>;
|
|
19
20
|
connection_id: t.Codec<bigint, string | number, string, t.CodecProps>;
|
|
20
|
-
relation_id: t.
|
|
21
|
+
relation_id: t.Codec<StoredRelationId | null, string | null>;
|
|
21
22
|
schema_name: t.IdentityCodec<t.CodecType.String>;
|
|
22
23
|
table_name: t.IdentityCodec<t.CodecType.String>;
|
|
23
|
-
replica_id_columns: t.
|
|
24
|
+
replica_id_columns: t.Codec<{
|
|
24
25
|
name: string;
|
|
25
26
|
type?: string | undefined;
|
|
26
|
-
|
|
27
|
-
}[]
|
|
27
|
+
type_oid?: number | undefined;
|
|
28
|
+
}[] | null, string | null>;
|
|
28
29
|
snapshot_done: t.IdentityCodec<t.CodecType.Boolean>;
|
|
29
|
-
snapshot_total_estimated_count: t.
|
|
30
|
-
snapshot_replicated_count: t.
|
|
31
|
-
snapshot_last_key: t.
|
|
30
|
+
snapshot_total_estimated_count: t.Codec<bigint | null, string | number | null>;
|
|
31
|
+
snapshot_replicated_count: t.Codec<bigint | null, string | number | null>;
|
|
32
|
+
snapshot_last_key: t.Codec<Buffer<ArrayBuffer> | null, string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Source-specific metadata. Null for legacy records.
|
|
35
|
+
*/
|
|
36
|
+
source_metadata: t.Codec<JsonValue, string | null>;
|
|
32
37
|
}>;
|
|
33
38
|
export type SourceTable = t.Encoded<typeof SourceTable>;
|
|
34
39
|
export type SourceTableDecoded = t.Decoded<typeof SourceTable>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { orNull } from '@powersync/service-types';
|
|
1
2
|
import * as t from 'ts-codec';
|
|
2
3
|
import { bigint, hexBuffer, jsonb, jsonb_raw, pgwire_number } from '../codecs.js';
|
|
3
4
|
export const ColumnDescriptor = t.object({
|
|
@@ -9,19 +10,23 @@ export const ColumnDescriptor = t.object({
|
|
|
9
10
|
/**
|
|
10
11
|
* Some data sources have a type id that can be used to identify the type of the column
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
type_oid: t.number.optional()
|
|
13
14
|
});
|
|
14
15
|
export const SourceTable = t.object({
|
|
15
16
|
id: t.string,
|
|
16
17
|
group_id: pgwire_number,
|
|
17
18
|
connection_id: bigint,
|
|
18
|
-
relation_id:
|
|
19
|
+
relation_id: orNull(jsonb_raw()),
|
|
19
20
|
schema_name: t.string,
|
|
20
21
|
table_name: t.string,
|
|
21
|
-
replica_id_columns:
|
|
22
|
+
replica_id_columns: orNull(jsonb(t.array(ColumnDescriptor))),
|
|
22
23
|
snapshot_done: t.boolean,
|
|
23
|
-
snapshot_total_estimated_count:
|
|
24
|
-
snapshot_replicated_count:
|
|
25
|
-
snapshot_last_key:
|
|
24
|
+
snapshot_total_estimated_count: orNull(bigint),
|
|
25
|
+
snapshot_replicated_count: orNull(bigint),
|
|
26
|
+
snapshot_last_key: orNull(hexBuffer),
|
|
27
|
+
/**
|
|
28
|
+
* Source-specific metadata. Null for legacy records.
|
|
29
|
+
*/
|
|
30
|
+
source_metadata: orNull(jsonb_raw())
|
|
26
31
|
});
|
|
27
32
|
//# sourceMappingURL=SourceTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceTable.js","sourceRoot":"","sources":["../../../src/types/models/SourceTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SourceTable.js","sourceRoot":"","sources":["../../../src/types/models/SourceTable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMlF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM;IACd;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IACzB;;OAEG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM;IACZ,QAAQ,EAAE,aAAa;IACvB,aAAa,EAAE,MAAM;IACrB,WAAW,EAAE,MAAM,CAAC,SAAS,EAAoB,CAAC;IAClD,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM;IACpB,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,CAAC,OAAO;IACxB,8BAA8B,EAAE,MAAM,CAAC,MAAM,CAAC;IAC9C,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC;IACzC,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC;IACpC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC,SAAS,EAAa,CAAC;CAChD,CAAC,CAAC"}
|
|
@@ -12,42 +12,43 @@ export declare const SyncRules: t.ObjectCodec<{
|
|
|
12
12
|
/**
|
|
13
13
|
* May be set if snapshot_done = false, if the replication stream requires it.
|
|
14
14
|
*/
|
|
15
|
-
snapshot_lsn: t.
|
|
15
|
+
snapshot_lsn: t.Codec<string | null, string | null>;
|
|
16
16
|
/**
|
|
17
17
|
* The last consistent checkpoint.
|
|
18
18
|
*
|
|
19
19
|
* There may be higher OpIds used in the database if we're in the middle of replicating a large transaction.
|
|
20
20
|
*/
|
|
21
|
-
last_checkpoint: t.
|
|
21
|
+
last_checkpoint: t.Codec<bigint | null, string | number | null>;
|
|
22
22
|
/**
|
|
23
23
|
* The LSN associated with the last consistent checkpoint.
|
|
24
24
|
*/
|
|
25
|
-
last_checkpoint_lsn: t.
|
|
25
|
+
last_checkpoint_lsn: t.Codec<string | null, string | null>;
|
|
26
26
|
/**
|
|
27
27
|
* If set, no new checkpoints may be created < this value.
|
|
28
28
|
*/
|
|
29
|
-
no_checkpoint_before: t.
|
|
29
|
+
no_checkpoint_before: t.Codec<string | null, string | null>;
|
|
30
30
|
slot_name: t.IdentityCodec<t.CodecType.String>;
|
|
31
31
|
/**
|
|
32
32
|
* Last time we persisted a checkpoint.
|
|
33
33
|
*
|
|
34
34
|
* This may be old if no data is incoming.
|
|
35
35
|
*/
|
|
36
|
-
last_checkpoint_ts: t.
|
|
36
|
+
last_checkpoint_ts: t.Codec<Date | null, string | import("@powersync/service-sync-rules").DateTimeValue | null>;
|
|
37
37
|
/**
|
|
38
38
|
* Last time we persisted a checkpoint or keepalive.
|
|
39
39
|
*
|
|
40
40
|
* This should stay fairly current while replicating.
|
|
41
41
|
*/
|
|
42
|
-
last_keepalive_ts: t.
|
|
42
|
+
last_keepalive_ts: t.Codec<Date | null, string | import("@powersync/service-sync-rules").DateTimeValue | null>;
|
|
43
43
|
/**
|
|
44
44
|
* If an error is stopping replication, it will be stored here.
|
|
45
45
|
*/
|
|
46
|
-
last_fatal_error: t.
|
|
47
|
-
keepalive_op: t.
|
|
46
|
+
last_fatal_error: t.Codec<string | null, string | null>;
|
|
47
|
+
keepalive_op: t.Codec<bigint | null, string | number | null>;
|
|
48
48
|
storage_version: t.OptionalCodec<t.Codec<number | null, number | null, string, t.CodecProps>>;
|
|
49
|
+
version_label: t.OptionalCodec<t.Codec<string | null, string | null, string, t.CodecProps>>;
|
|
49
50
|
content: t.IdentityCodec<t.CodecType.String>;
|
|
50
|
-
sync_plan: t.
|
|
51
|
+
sync_plan: t.Codec<{
|
|
51
52
|
plan: any;
|
|
52
53
|
compatibility: {
|
|
53
54
|
edition: number;
|
|
@@ -64,7 +65,7 @@ export declare const SyncRules: t.ObjectCodec<{
|
|
|
64
65
|
} | undefined;
|
|
65
66
|
ts?: string | undefined;
|
|
66
67
|
}[] | undefined;
|
|
67
|
-
}, import("@powersync/service-jsonbig").JsonContainer
|
|
68
|
+
} | null, import("@powersync/service-jsonbig").JsonContainer | null>;
|
|
68
69
|
}>;
|
|
69
70
|
export type SyncRules = t.Encoded<typeof SyncRules>;
|
|
70
71
|
export type SyncRulesDecoded = t.Decoded<typeof SyncRules>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { framework, storage } from '@powersync/service-core';
|
|
2
|
-
import { ReplicationError } from '@powersync/service-types';
|
|
2
|
+
import { orNull, ReplicationError } from '@powersync/service-types';
|
|
3
3
|
import * as t from 'ts-codec';
|
|
4
4
|
import { bigint, pgwire_number } from '../codecs.js';
|
|
5
5
|
import { jsonContainerObject } from './json.js';
|
|
@@ -15,42 +15,43 @@ export const SyncRules = t.object({
|
|
|
15
15
|
/**
|
|
16
16
|
* May be set if snapshot_done = false, if the replication stream requires it.
|
|
17
17
|
*/
|
|
18
|
-
snapshot_lsn:
|
|
18
|
+
snapshot_lsn: orNull(t.string),
|
|
19
19
|
/**
|
|
20
20
|
* The last consistent checkpoint.
|
|
21
21
|
*
|
|
22
22
|
* There may be higher OpIds used in the database if we're in the middle of replicating a large transaction.
|
|
23
23
|
*/
|
|
24
|
-
last_checkpoint:
|
|
24
|
+
last_checkpoint: orNull(bigint),
|
|
25
25
|
/**
|
|
26
26
|
* The LSN associated with the last consistent checkpoint.
|
|
27
27
|
*/
|
|
28
|
-
last_checkpoint_lsn:
|
|
28
|
+
last_checkpoint_lsn: orNull(t.string),
|
|
29
29
|
/**
|
|
30
30
|
* If set, no new checkpoints may be created < this value.
|
|
31
31
|
*/
|
|
32
|
-
no_checkpoint_before:
|
|
32
|
+
no_checkpoint_before: orNull(t.string),
|
|
33
33
|
slot_name: t.string,
|
|
34
34
|
/**
|
|
35
35
|
* Last time we persisted a checkpoint.
|
|
36
36
|
*
|
|
37
37
|
* This may be old if no data is incoming.
|
|
38
38
|
*/
|
|
39
|
-
last_checkpoint_ts:
|
|
39
|
+
last_checkpoint_ts: orNull(framework.codecs.date),
|
|
40
40
|
/**
|
|
41
41
|
* Last time we persisted a checkpoint or keepalive.
|
|
42
42
|
*
|
|
43
43
|
* This should stay fairly current while replicating.
|
|
44
44
|
*/
|
|
45
|
-
last_keepalive_ts:
|
|
45
|
+
last_keepalive_ts: orNull(framework.codecs.date),
|
|
46
46
|
/**
|
|
47
47
|
* If an error is stopping replication, it will be stored here.
|
|
48
48
|
*/
|
|
49
|
-
last_fatal_error:
|
|
50
|
-
keepalive_op:
|
|
51
|
-
storage_version:
|
|
49
|
+
last_fatal_error: orNull(t.string),
|
|
50
|
+
keepalive_op: orNull(bigint),
|
|
51
|
+
storage_version: orNull(pgwire_number).optional(),
|
|
52
|
+
version_label: orNull(t.string).optional(),
|
|
52
53
|
content: t.string,
|
|
53
|
-
sync_plan:
|
|
54
|
+
sync_plan: orNull(jsonContainerObject(t.object({
|
|
54
55
|
plan: t.any,
|
|
55
56
|
compatibility: t.object({
|
|
56
57
|
edition: t.number,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncRules.js","sourceRoot":"","sources":["../../../src/types/models/SyncRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"SyncRules.js","sourceRoot":"","sources":["../../../src/types/models/SyncRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACpC;;;;OAIG;IACH,aAAa,EAAE,CAAC,CAAC,OAAO;IACxB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9B;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC;IAC/B;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACrC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;IACjD;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;IAChD;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACjD,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,SAAS,EAAE,MAAM,CACf,mBAAmB,CACjB,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,GAAG;QACX,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC;YACtB,OAAO,EAAE,CAAC,CAAC,MAAM;YACjB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YAC9B,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;SAC3C,CAAC;QACF,gBAAgB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;KAC7C,CAAC,CACH,CACF;CACF,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ export declare const WriteCheckpoint: t.ObjectCodec<{
|
|
|
3
3
|
user_id: t.IdentityCodec<t.CodecType.String>;
|
|
4
4
|
lsns: t.Codec<Record<string, string>, string, string, t.CodecProps>;
|
|
5
5
|
write_checkpoint: t.Codec<bigint, string | number, string, t.CodecProps>;
|
|
6
|
-
checkpoint_requested_at: t.
|
|
6
|
+
checkpoint_requested_at: t.Codec<Date | null, string | import("@powersync/service-sync-rules").DateTimeValue | null>;
|
|
7
7
|
}>;
|
|
8
8
|
export type WriteCheckpoint = t.Encoded<typeof WriteCheckpoint>;
|
|
9
9
|
export type WriteCheckpointDecoded = t.Decoded<typeof WriteCheckpoint>;
|
|
@@ -11,7 +11,7 @@ export declare const CustomWriteCheckpoint: t.ObjectCodec<{
|
|
|
11
11
|
user_id: t.IdentityCodec<t.CodecType.String>;
|
|
12
12
|
write_checkpoint: t.Codec<bigint, string | number, string, t.CodecProps>;
|
|
13
13
|
sync_rules_id: t.Codec<bigint, string | number, string, t.CodecProps>;
|
|
14
|
-
checkpoint_requested_at: t.
|
|
14
|
+
checkpoint_requested_at: t.Codec<Date | null, string | import("@powersync/service-sync-rules").DateTimeValue | null>;
|
|
15
15
|
}>;
|
|
16
16
|
export type CustomWriteCheckpoint = t.Encoded<typeof CustomWriteCheckpoint>;
|
|
17
17
|
export type CustomWriteCheckpointDecoded = t.Decoded<typeof CustomWriteCheckpoint>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { framework } from '@powersync/service-core';
|
|
2
|
+
import { orNull } from '@powersync/service-types';
|
|
2
3
|
import * as t from 'ts-codec';
|
|
3
4
|
import { bigint, jsonb } from '../codecs.js';
|
|
4
5
|
export const WriteCheckpoint = t.object({
|
|
5
6
|
user_id: t.string,
|
|
6
7
|
lsns: jsonb(t.record(t.string)),
|
|
7
8
|
write_checkpoint: bigint,
|
|
8
|
-
checkpoint_requested_at:
|
|
9
|
+
checkpoint_requested_at: orNull(framework.codecs.date)
|
|
9
10
|
});
|
|
10
11
|
export const CustomWriteCheckpoint = t.object({
|
|
11
12
|
user_id: t.string,
|
|
12
13
|
write_checkpoint: bigint,
|
|
13
14
|
sync_rules_id: bigint,
|
|
14
|
-
checkpoint_requested_at:
|
|
15
|
+
checkpoint_requested_at: orNull(framework.codecs.date)
|
|
15
16
|
});
|
|
16
17
|
//# sourceMappingURL=WriteCheckpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WriteCheckpoint.js","sourceRoot":"","sources":["../../../src/types/models/WriteCheckpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/B,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"WriteCheckpoint.js","sourceRoot":"","sources":["../../../src/types/models/WriteCheckpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/B,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;CACvD,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,gBAAgB,EAAE,MAAM;IACxB,aAAa,EAAE,MAAM;IACrB,uBAAuB,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;CACvD,CAAC,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type OperationBatchLimits = t.Encoded<typeof OperationBatchLimits>;
|
|
|
32
32
|
export declare const PostgresStorageConfig: t.Intersection<t.Codec<{
|
|
33
33
|
type: string;
|
|
34
34
|
max_pool_size?: number | undefined;
|
|
35
|
+
default_storage_version?: number | undefined;
|
|
35
36
|
} & {
|
|
36
37
|
type: "postgresql";
|
|
37
38
|
id?: string | undefined;
|
|
@@ -54,6 +55,7 @@ export declare const PostgresStorageConfig: t.Intersection<t.Codec<{
|
|
|
54
55
|
}, {
|
|
55
56
|
type: string;
|
|
56
57
|
max_pool_size?: number | undefined;
|
|
58
|
+
default_storage_version?: number | undefined;
|
|
57
59
|
} & {
|
|
58
60
|
type: "postgresql";
|
|
59
61
|
id?: string | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { framework, TestStorageOptions } from '@powersync/service-core';
|
|
1
|
+
import { framework, SyncConfigParser, TestStorageOptions } from '@powersync/service-core';
|
|
2
2
|
import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
|
|
3
3
|
import { PostgresBucketStorageFactory } from '../storage/PostgresBucketStorageFactory.js';
|
|
4
4
|
import { PostgresReportStorage } from '../storage/PostgresReportStorage.js';
|
|
5
5
|
import { PostgresStorageConfigDecoded } from '../types/types.js';
|
|
6
6
|
export type PostgresTestStorageOptions = {
|
|
7
7
|
url: string;
|
|
8
|
+
syncConfigParser?: SyncConfigParser;
|
|
8
9
|
/**
|
|
9
10
|
* Vitest can cause issues when loading .ts files for migrations.
|
|
10
11
|
* This allows for providing a custom PostgresMigrationAgent.
|
package/dist/utils/test-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger, logger as defaultLogger, transports } from '@powersync/lib-services-framework';
|
|
2
|
-
import { framework } from '@powersync/service-core';
|
|
2
|
+
import { framework, SqlSyncConfigParser } from '@powersync/service-core';
|
|
3
3
|
import { PostgresMigrationAgent } from '../migrations/PostgresMigrationAgent.js';
|
|
4
4
|
import { PostgresBucketStorageFactory } from '../storage/PostgresBucketStorageFactory.js';
|
|
5
5
|
import { PostgresReportStorage } from '../storage/PostgresReportStorage.js';
|
|
@@ -55,7 +55,7 @@ export function postgresTestSetup(factoryOptions) {
|
|
|
55
55
|
await using storageFactory = new PostgresBucketStorageFactory({
|
|
56
56
|
config: TEST_CONNECTION_OPTIONS,
|
|
57
57
|
replicationStreamNamePrefix: 'test_'
|
|
58
|
-
});
|
|
58
|
+
}, factoryOptions.syncConfigParser ?? new SqlSyncConfigParser());
|
|
59
59
|
await truncateTables(storageFactory.db);
|
|
60
60
|
};
|
|
61
61
|
return {
|
|
@@ -82,7 +82,7 @@ export function postgresTestSetup(factoryOptions) {
|
|
|
82
82
|
return new PostgresBucketStorageFactory({
|
|
83
83
|
config: TEST_CONNECTION_OPTIONS,
|
|
84
84
|
replicationStreamNamePrefix: 'test_'
|
|
85
|
-
});
|
|
85
|
+
}, factoryOptions.syncConfigParser ?? new SqlSyncConfigParser());
|
|
86
86
|
}
|
|
87
87
|
catch (ex) {
|
|
88
88
|
// Vitest does not display these errors nicely when using the `await using` syntx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/utils/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,aAAa,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACtG,OAAO,
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/utils/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,aAAa,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACtG,OAAO,EACL,SAAS,EAGT,mBAAmB,EAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,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gBACZ,iFAAiF;gBACjF,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC5B,MAAM,EAAE,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,OAA4B,EAAE,EAAE;YAC9C,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;oBACzB,MAAM,YAAY,EAAE,CAAC;gBACvB,CAAC;gBAED,OAAO,IAAI,4BAA4B,CACrC;oBACE,MAAM,EAAE,uBAAuB;oBAC/B,2BAA2B,EAAE,OAAO;iBACrC,EACD,cAAc,CAAC,gBAAgB,IAAI,IAAI,mBAAmB,EAAE,CAC7D,CAAC;YACJ,CAAC;YAAC,OAAO,EAAE,EAAE,CAAC;gBACZ,iFAAiF;gBACjF,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC5B,MAAM,EAAE,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO;QACP,cAAc,EAAE,IAAI;KACrB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/service-module-postgres-storage",
|
|
3
3
|
"repository": "https://github.com/powersync-ja/powersync-service",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-20260929095716",
|
|
5
5
|
"license": "FSL-1.1-ALv2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"lru-cache": "^10.2.2",
|
|
17
17
|
"ts-codec": "^1.3.0",
|
|
18
18
|
"uuid": "^14.0.0",
|
|
19
|
-
"@powersync/lib-service-postgres": "0.0.0-dev-
|
|
20
|
-
"@powersync/
|
|
21
|
-
"@powersync/
|
|
22
|
-
"@powersync/service-types": "0.
|
|
23
|
-
"@powersync/service-jpgwire": "0.0.0-dev-20260803144812",
|
|
19
|
+
"@powersync/lib-service-postgres": "0.0.0-dev-20260929095716",
|
|
20
|
+
"@powersync/service-core": "0.0.0-dev-20260929095716",
|
|
21
|
+
"@powersync/lib-services-framework": "0.0.0-dev-20260929095716",
|
|
22
|
+
"@powersync/service-types": "0.18.0",
|
|
24
23
|
"@powersync/service-jsonbig": "0.17.13",
|
|
25
|
-
"@powersync/service-sync-rules": "0.0.0-dev-
|
|
24
|
+
"@powersync/service-sync-rules": "0.0.0-dev-20260929095716",
|
|
25
|
+
"@powersync/service-jpgwire": "0.0.0-dev-20260929095716"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "~6.0.3",
|
|
29
|
-
"@powersync/service-core-tests": "0.0.0-dev-
|
|
29
|
+
"@powersync/service-core-tests": "0.0.0-dev-20260929095716"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc -b",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { migrations } from '@powersync/service-core';
|
|
2
|
+
|
|
3
|
+
import { openMigrationDB } from '../migration-utils.js';
|
|
4
|
+
|
|
5
|
+
export const up: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
6
|
+
const {
|
|
7
|
+
service_context: { configuration }
|
|
8
|
+
} = context;
|
|
9
|
+
await using client = openMigrationDB(configuration.storage);
|
|
10
|
+
|
|
11
|
+
await client.transaction(async (db) => {
|
|
12
|
+
await db.sql`
|
|
13
|
+
ALTER TABLE source_tables
|
|
14
|
+
ADD COLUMN source_metadata JSONB
|
|
15
|
+
`.execute();
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const down: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
20
|
+
const {
|
|
21
|
+
service_context: { configuration }
|
|
22
|
+
} = context;
|
|
23
|
+
await using client = openMigrationDB(configuration.storage);
|
|
24
|
+
|
|
25
|
+
await client.transaction(async (db) => {
|
|
26
|
+
await db.sql`
|
|
27
|
+
ALTER TABLE source_tables
|
|
28
|
+
DROP COLUMN source_metadata
|
|
29
|
+
`.execute();
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { migrations } from '@powersync/service-core';
|
|
2
|
+
import { openMigrationDB } from '../migration-utils.js';
|
|
3
|
+
|
|
4
|
+
export const up: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
5
|
+
const {
|
|
6
|
+
service_context: { configuration }
|
|
7
|
+
} = context;
|
|
8
|
+
await using client = openMigrationDB(configuration.storage);
|
|
9
|
+
await client.sql`ALTER TABLE sync_rules ADD COLUMN version_label TEXT`.execute();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const down: migrations.PowerSyncMigrationFunction = async (context) => {
|
|
13
|
+
const {
|
|
14
|
+
service_context: { configuration }
|
|
15
|
+
} = context;
|
|
16
|
+
await using client = openMigrationDB(configuration.storage);
|
|
17
|
+
await client.sql`ALTER TABLE sync_rules DROP COLUMN version_label`.execute();
|
|
18
|
+
};
|