@dxos/migrations 0.3.10-next.ef70620 → 0.3.10
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/lib/browser/index.mjs +3 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +3 -5
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/migrations.d.ts +1 -3
- package/dist/types/src/migrations.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/migrations.ts +3 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/sdk/migrations/src/migrations.ts
|
|
2
2
|
import { SpaceState } from "@dxos/client/echo";
|
|
3
3
|
import { invariant } from "@dxos/invariant";
|
|
4
|
-
var __dxlog_file = "/home/
|
|
4
|
+
var __dxlog_file = "/home/circleci/project/packages/sdk/migrations/src/migrations.ts";
|
|
5
5
|
var Migrations = class {
|
|
6
6
|
static {
|
|
7
7
|
this.migrations = [];
|
|
@@ -17,7 +17,7 @@ var Migrations = class {
|
|
|
17
17
|
static async migrate(space, targetVersion) {
|
|
18
18
|
invariant(this.versionProperty, "Migrations namespace not set", {
|
|
19
19
|
F: __dxlog_file,
|
|
20
|
-
L:
|
|
20
|
+
L: 34,
|
|
21
21
|
S: this,
|
|
22
22
|
A: [
|
|
23
23
|
"this.versionProperty",
|
|
@@ -26,7 +26,7 @@ var Migrations = class {
|
|
|
26
26
|
});
|
|
27
27
|
invariant(space.state.get() === SpaceState.READY, "Space not ready", {
|
|
28
28
|
F: __dxlog_file,
|
|
29
|
-
L:
|
|
29
|
+
L: 35,
|
|
30
30
|
S: this,
|
|
31
31
|
A: [
|
|
32
32
|
"space.state.get() === SpaceState.READY",
|
|
@@ -44,7 +44,6 @@ var Migrations = class {
|
|
|
44
44
|
const migrations = this.migrations.slice(currentIndex, targetIndex);
|
|
45
45
|
for (const migration of migrations) {
|
|
46
46
|
await migration.up({
|
|
47
|
-
version: migration.version,
|
|
48
47
|
space
|
|
49
48
|
});
|
|
50
49
|
space.properties[this.versionProperty] = migration.version;
|
|
@@ -54,7 +53,6 @@ var Migrations = class {
|
|
|
54
53
|
migrations.reverse();
|
|
55
54
|
for (const migration of migrations) {
|
|
56
55
|
await migration.down({
|
|
57
|
-
version: migration.version,
|
|
58
56
|
space
|
|
59
57
|
});
|
|
60
58
|
const index = this.migrations.indexOf(migration);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/migrations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { invariant } from '@dxos/invariant';\nimport type { MaybePromise } from '@dxos/util';\n\nexport type MigrationContext = {\n
|
|
5
|
-
"mappings": ";AAIA,SAAqBA,kBAAkB;AACvC,SAASC,iBAAiB;;
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { invariant } from '@dxos/invariant';\nimport type { MaybePromise } from '@dxos/util';\n\nexport type MigrationContext = {\n space: Space;\n};\n\nexport type Migration = {\n version: string | number;\n up: (context: MigrationContext) => MaybePromise<void>;\n down: (context: MigrationContext) => MaybePromise<void>;\n};\n\nexport class Migrations {\n static namespace?: string;\n static migrations: Migration[] = [];\n\n static get versionProperty() {\n return this.namespace && `${this.namespace}.version`;\n }\n\n static define(namespace: string, migrations: Migration[]) {\n this.namespace = namespace;\n this.migrations = migrations;\n }\n\n // TODO(wittjosiah): Multi-space migrations.\n static async migrate(space: Space, targetVersion?: string | number) {\n invariant(this.versionProperty, 'Migrations namespace not set');\n invariant(space.state.get() === SpaceState.READY, 'Space not ready');\n const currentVersion = space.properties[this.versionProperty];\n const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;\n const i = this.migrations.findIndex((m) => m.version === targetVersion);\n const targetIndex = i === -1 ? this.migrations.length : i + 1;\n if (currentIndex === targetIndex) {\n return false;\n }\n\n if (targetIndex > currentIndex) {\n const migrations = this.migrations.slice(currentIndex, targetIndex);\n for (const migration of migrations) {\n await migration.up({ space });\n space.properties[this.versionProperty] = migration.version;\n }\n } else {\n const migrations = this.migrations.slice(targetIndex, currentIndex);\n migrations.reverse();\n for (const migration of migrations) {\n await migration.down({ space });\n const index = this.migrations.indexOf(migration);\n space.properties[this.versionProperty] = this.migrations[index - 1]?.version;\n }\n }\n\n return true;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAqBA,kBAAkB;AACvC,SAASC,iBAAiB;;AAanB,IAAMC,aAAN,MAAMA;EAEX;SAAOC,aAA0B,CAAA;;EAEjC,WAAWC,kBAAkB;AAC3B,WAAO,KAAKC,aAAa,GAAG,KAAKA,SAAS;EAC5C;EAEA,OAAOC,OAAOD,WAAmBF,YAAyB;AACxD,SAAKE,YAAYA;AACjB,SAAKF,aAAaA;EACpB;;EAGA,aAAaI,QAAQC,OAAcC,eAAiC;AAClER,cAAU,KAAKG,iBAAiB,gCAAA;;;;;;;;;AAChCH,cAAUO,MAAME,MAAMC,IAAG,MAAOX,WAAWY,OAAO,mBAAA;;;;;;;;;AAClD,UAAMC,iBAAiBL,MAAMM,WAAW,KAAKV,eAAe;AAC5D,UAAMW,eAAe,KAAKZ,WAAWa,UAAU,CAACC,MAAMA,EAAEC,YAAYL,cAAAA,IAAkB;AACtF,UAAMM,IAAI,KAAKhB,WAAWa,UAAU,CAACC,MAAMA,EAAEC,YAAYT,aAAAA;AACzD,UAAMW,cAAcD,MAAM,KAAK,KAAKhB,WAAWkB,SAASF,IAAI;AAC5D,QAAIJ,iBAAiBK,aAAa;AAChC,aAAO;IACT;AAEA,QAAIA,cAAcL,cAAc;AAC9B,YAAMZ,aAAa,KAAKA,WAAWmB,MAAMP,cAAcK,WAAAA;AACvD,iBAAWG,aAAapB,YAAY;AAClC,cAAMoB,UAAUC,GAAG;UAAEhB;QAAM,CAAA;AAC3BA,cAAMM,WAAW,KAAKV,eAAe,IAAImB,UAAUL;MACrD;IACF,OAAO;AACL,YAAMf,aAAa,KAAKA,WAAWmB,MAAMF,aAAaL,YAAAA;AACtDZ,iBAAWsB,QAAO;AAClB,iBAAWF,aAAapB,YAAY;AAClC,cAAMoB,UAAUG,KAAK;UAAElB;QAAM,CAAA;AAC7B,cAAMmB,QAAQ,KAAKxB,WAAWyB,QAAQL,SAAAA;AACtCf,cAAMM,WAAW,KAAKV,eAAe,IAAI,KAAKD,WAAWwB,QAAQ,CAAA,GAAIT;MACvE;IACF;AAEA,WAAO;EACT;AACF;",
|
|
6
6
|
"names": ["SpaceState", "invariant", "Migrations", "migrations", "versionProperty", "namespace", "define", "migrate", "space", "targetVersion", "state", "get", "READY", "currentVersion", "properties", "currentIndex", "findIndex", "m", "version", "i", "targetIndex", "length", "slice", "migration", "up", "reverse", "down", "index", "indexOf"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytes":7616,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/migrations/src/index.ts":{"bytes":464,"imports":[{"path":"packages/sdk/migrations/src/migrations.ts","kind":"import-statement","original":"./migrations"}],"format":"esm"}},"outputs":{"packages/sdk/migrations/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3630},"packages/sdk/migrations/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["Migrations"],"entryPoint":"packages/sdk/migrations/src/index.ts","inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytesInOutput":2059},"packages/sdk/migrations/src/index.ts":{"bytesInOutput":0}},"bytes":2164}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(node_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(node_exports);
|
|
24
24
|
var import_echo = require("@dxos/client/echo");
|
|
25
25
|
var import_invariant = require("@dxos/invariant");
|
|
26
|
-
var __dxlog_file = "/home/
|
|
26
|
+
var __dxlog_file = "/home/circleci/project/packages/sdk/migrations/src/migrations.ts";
|
|
27
27
|
var Migrations = class {
|
|
28
28
|
static {
|
|
29
29
|
this.migrations = [];
|
|
@@ -39,7 +39,7 @@ var Migrations = class {
|
|
|
39
39
|
static async migrate(space, targetVersion) {
|
|
40
40
|
(0, import_invariant.invariant)(this.versionProperty, "Migrations namespace not set", {
|
|
41
41
|
F: __dxlog_file,
|
|
42
|
-
L:
|
|
42
|
+
L: 34,
|
|
43
43
|
S: this,
|
|
44
44
|
A: [
|
|
45
45
|
"this.versionProperty",
|
|
@@ -48,7 +48,7 @@ var Migrations = class {
|
|
|
48
48
|
});
|
|
49
49
|
(0, import_invariant.invariant)(space.state.get() === import_echo.SpaceState.READY, "Space not ready", {
|
|
50
50
|
F: __dxlog_file,
|
|
51
|
-
L:
|
|
51
|
+
L: 35,
|
|
52
52
|
S: this,
|
|
53
53
|
A: [
|
|
54
54
|
"space.state.get() === SpaceState.READY",
|
|
@@ -66,7 +66,6 @@ var Migrations = class {
|
|
|
66
66
|
const migrations = this.migrations.slice(currentIndex, targetIndex);
|
|
67
67
|
for (const migration of migrations) {
|
|
68
68
|
await migration.up({
|
|
69
|
-
version: migration.version,
|
|
70
69
|
space
|
|
71
70
|
});
|
|
72
71
|
space.properties[this.versionProperty] = migration.version;
|
|
@@ -76,7 +75,6 @@ var Migrations = class {
|
|
|
76
75
|
migrations.reverse();
|
|
77
76
|
for (const migration of migrations) {
|
|
78
77
|
await migration.down({
|
|
79
|
-
version: migration.version,
|
|
80
78
|
space
|
|
81
79
|
});
|
|
82
80
|
const index = this.migrations.indexOf(migration);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/migrations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { invariant } from '@dxos/invariant';\nimport type { MaybePromise } from '@dxos/util';\n\nexport type MigrationContext = {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,kBAAuC;AACvC,uBAA0B;;
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { invariant } from '@dxos/invariant';\nimport type { MaybePromise } from '@dxos/util';\n\nexport type MigrationContext = {\n space: Space;\n};\n\nexport type Migration = {\n version: string | number;\n up: (context: MigrationContext) => MaybePromise<void>;\n down: (context: MigrationContext) => MaybePromise<void>;\n};\n\nexport class Migrations {\n static namespace?: string;\n static migrations: Migration[] = [];\n\n static get versionProperty() {\n return this.namespace && `${this.namespace}.version`;\n }\n\n static define(namespace: string, migrations: Migration[]) {\n this.namespace = namespace;\n this.migrations = migrations;\n }\n\n // TODO(wittjosiah): Multi-space migrations.\n static async migrate(space: Space, targetVersion?: string | number) {\n invariant(this.versionProperty, 'Migrations namespace not set');\n invariant(space.state.get() === SpaceState.READY, 'Space not ready');\n const currentVersion = space.properties[this.versionProperty];\n const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;\n const i = this.migrations.findIndex((m) => m.version === targetVersion);\n const targetIndex = i === -1 ? this.migrations.length : i + 1;\n if (currentIndex === targetIndex) {\n return false;\n }\n\n if (targetIndex > currentIndex) {\n const migrations = this.migrations.slice(currentIndex, targetIndex);\n for (const migration of migrations) {\n await migration.up({ space });\n space.properties[this.versionProperty] = migration.version;\n }\n } else {\n const migrations = this.migrations.slice(targetIndex, currentIndex);\n migrations.reverse();\n for (const migration of migrations) {\n await migration.down({ space });\n const index = this.migrations.indexOf(migration);\n space.properties[this.versionProperty] = this.migrations[index - 1]?.version;\n }\n }\n\n return true;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,kBAAuC;AACvC,uBAA0B;;AAanB,IAAMA,aAAN,MAAMA;EAEX,OAAA;SAAOC,aAA0B,CAAA;;EAEjC,WAAWC,kBAAkB;AAC3B,WAAO,KAAKC,aAAa,GAAG,KAAKA,SAAS;EAC5C;EAEA,OAAOC,OAAOD,WAAmBF,YAAyB;AACxD,SAAKE,YAAYA;AACjB,SAAKF,aAAaA;EACpB;;EAGA,aAAaI,QAAQC,OAAcC,eAAiC;AAClEC,oCAAU,KAAKN,iBAAiB,gCAAA;;;;;;;;;AAChCM,oCAAUF,MAAMG,MAAMC,IAAG,MAAOC,uBAAWC,OAAO,mBAAA;;;;;;;;;AAClD,UAAMC,iBAAiBP,MAAMQ,WAAW,KAAKZ,eAAe;AAC5D,UAAMa,eAAe,KAAKd,WAAWe,UAAU,CAACC,MAAMA,EAAEC,YAAYL,cAAAA,IAAkB;AACtF,UAAMM,IAAI,KAAKlB,WAAWe,UAAU,CAACC,MAAMA,EAAEC,YAAYX,aAAAA;AACzD,UAAMa,cAAcD,MAAM,KAAK,KAAKlB,WAAWoB,SAASF,IAAI;AAC5D,QAAIJ,iBAAiBK,aAAa;AAChC,aAAO;IACT;AAEA,QAAIA,cAAcL,cAAc;AAC9B,YAAMd,aAAa,KAAKA,WAAWqB,MAAMP,cAAcK,WAAAA;AACvD,iBAAWG,aAAatB,YAAY;AAClC,cAAMsB,UAAUC,GAAG;UAAElB;QAAM,CAAA;AAC3BA,cAAMQ,WAAW,KAAKZ,eAAe,IAAIqB,UAAUL;MACrD;IACF,OAAO;AACL,YAAMjB,aAAa,KAAKA,WAAWqB,MAAMF,aAAaL,YAAAA;AACtDd,iBAAWwB,QAAO;AAClB,iBAAWF,aAAatB,YAAY;AAClC,cAAMsB,UAAUG,KAAK;UAAEpB;QAAM,CAAA;AAC7B,cAAMqB,QAAQ,KAAK1B,WAAW2B,QAAQL,SAAAA;AACtCjB,cAAMQ,WAAW,KAAKZ,eAAe,IAAI,KAAKD,WAAW0B,QAAQ,CAAA,GAAIT;MACvE;IACF;AAEA,WAAO;EACT;AACF;",
|
|
6
6
|
"names": ["Migrations", "migrations", "versionProperty", "namespace", "define", "migrate", "space", "targetVersion", "invariant", "state", "get", "SpaceState", "READY", "currentVersion", "properties", "currentIndex", "findIndex", "m", "version", "i", "targetIndex", "length", "slice", "migration", "up", "reverse", "down", "index", "indexOf"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytes":7616,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/migrations/src/index.ts":{"bytes":464,"imports":[{"path":"packages/sdk/migrations/src/migrations.ts","kind":"import-statement","original":"./migrations"}],"format":"esm"}},"outputs":{"packages/sdk/migrations/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3630},"packages/sdk/migrations/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["Migrations"],"entryPoint":"packages/sdk/migrations/src/index.ts","inputs":{"packages/sdk/migrations/src/migrations.ts":{"bytesInOutput":2059},"packages/sdk/migrations/src/index.ts":{"bytesInOutput":0}},"bytes":2164}}}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type Space } from '@dxos/client/echo';
|
|
2
2
|
import type { MaybePromise } from '@dxos/util';
|
|
3
3
|
export type MigrationContext = {
|
|
4
|
-
version: string | number;
|
|
5
4
|
space: Space;
|
|
6
5
|
};
|
|
7
|
-
type Migration = {
|
|
6
|
+
export type Migration = {
|
|
8
7
|
version: string | number;
|
|
9
8
|
up: (context: MigrationContext) => MaybePromise<void>;
|
|
10
9
|
down: (context: MigrationContext) => MaybePromise<void>;
|
|
@@ -16,5 +15,4 @@ export declare class Migrations {
|
|
|
16
15
|
static define(namespace: string, migrations: Migration[]): void;
|
|
17
16
|
static migrate(space: Space, targetVersion?: string | number): Promise<boolean>;
|
|
18
17
|
}
|
|
19
|
-
export {};
|
|
20
18
|
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/migrations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/migrations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,EAAE,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC;AAEF,qBAAa,UAAU;IACrB,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,CAAM;IAEpC,MAAM,KAAK,eAAe,uBAEzB;IAED,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE;WAM3C,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;CA6BnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/migrations",
|
|
3
|
-
"version": "0.3.10
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"src"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dxos/
|
|
24
|
-
"@dxos/
|
|
25
|
-
"@dxos/
|
|
23
|
+
"@dxos/util": "0.3.10",
|
|
24
|
+
"@dxos/invariant": "0.3.10",
|
|
25
|
+
"@dxos/client": "0.3.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {},
|
|
28
28
|
"publishConfig": {
|
package/src/migrations.ts
CHANGED
|
@@ -7,11 +7,10 @@ import { invariant } from '@dxos/invariant';
|
|
|
7
7
|
import type { MaybePromise } from '@dxos/util';
|
|
8
8
|
|
|
9
9
|
export type MigrationContext = {
|
|
10
|
-
version: string | number;
|
|
11
10
|
space: Space;
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
type Migration = {
|
|
13
|
+
export type Migration = {
|
|
15
14
|
version: string | number;
|
|
16
15
|
up: (context: MigrationContext) => MaybePromise<void>;
|
|
17
16
|
down: (context: MigrationContext) => MaybePromise<void>;
|
|
@@ -45,14 +44,14 @@ export class Migrations {
|
|
|
45
44
|
if (targetIndex > currentIndex) {
|
|
46
45
|
const migrations = this.migrations.slice(currentIndex, targetIndex);
|
|
47
46
|
for (const migration of migrations) {
|
|
48
|
-
await migration.up({
|
|
47
|
+
await migration.up({ space });
|
|
49
48
|
space.properties[this.versionProperty] = migration.version;
|
|
50
49
|
}
|
|
51
50
|
} else {
|
|
52
51
|
const migrations = this.migrations.slice(targetIndex, currentIndex);
|
|
53
52
|
migrations.reverse();
|
|
54
53
|
for (const migration of migrations) {
|
|
55
|
-
await migration.down({
|
|
54
|
+
await migration.down({ space });
|
|
56
55
|
const index = this.migrations.indexOf(migration);
|
|
57
56
|
space.properties[this.versionProperty] = this.migrations[index - 1]?.version;
|
|
58
57
|
}
|