@medusajs/link-modules 1.0.0-rc-20241003153304 → 1.0.0-rc-20241014151055
Sign up to get free protection for your applications and to get access to all the features.
@@ -81,7 +81,7 @@ export declare class MigrationsExecutionPlanner implements ILinkMigrationsPlanne
|
|
81
81
|
/**
|
82
82
|
* Renames existing table and also its tracked entry
|
83
83
|
*/
|
84
|
-
protected renameOldTable(orm: MikroORM<PostgreSqlDriver>, oldName: string, newName: string): Promise<void>;
|
84
|
+
protected renameOldTable(orm: MikroORM<PostgreSqlDriver>, oldName: string, newName: string, descriptor: PlannerActionLinkDescriptor): Promise<void>;
|
85
85
|
/**
|
86
86
|
* Creates a plan to executed in order to keep the database state in
|
87
87
|
* sync with the user-defined links.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAA;AASlC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxE;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,sBAAsB;;IAoBvE;;;OAGG;IACH,SAAS,CAAC,SAAS,SAA2B;gBAG5C,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,CAAC,EAAE,8BAA8B;IAyB1C;;;OAGG;cACa,SAAS,CAAC,QAAQ,GAAE,YAAY,EAAO;IAIvD;;;;;OAKG;cACa,qBAAqB,CACnC,GAAG,EAAE,QAAQ,CAAC,g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GED
@@ -187,7 +187,7 @@ class MigrationsExecutionPlanner {
|
|
187
187
|
action: "create",
|
188
188
|
linkDescriptor,
|
189
189
|
tableName,
|
190
|
-
sql: await generator.getCreateSchemaSQL(),
|
190
|
+
sql: (0, utils_1.normalizeMigrationSQL)(await generator.getCreateSchemaSQL()),
|
191
191
|
};
|
192
192
|
}
|
193
193
|
/**
|
@@ -207,9 +207,9 @@ class MigrationsExecutionPlanner {
|
|
207
207
|
schema_name: schemaName,
|
208
208
|
},
|
209
209
|
]);
|
210
|
-
const updateSQL = await generator.getUpdateSchemaSQL({
|
210
|
+
const updateSQL = (0, utils_1.normalizeMigrationSQL)(await generator.getUpdateSchemaSQL({
|
211
211
|
fromSchema: dbSchema,
|
212
|
-
});
|
212
|
+
}));
|
213
213
|
/**
|
214
214
|
* Entity is upto-date and hence we do not have to perform
|
215
215
|
* any updates on it.
|
@@ -245,21 +245,22 @@ class MigrationsExecutionPlanner {
|
|
245
245
|
async migrateOldTables(orm, trackedTables) {
|
246
246
|
const migratedTables = [];
|
247
247
|
for (let trackedTable of trackedTables) {
|
248
|
-
const
|
248
|
+
const linkEntity = __classPrivateFieldGet(this, _MigrationsExecutionPlanner_linksEntities, "f").find((entity) => {
|
249
249
|
return (entity.linkDescriptor.fromModel ===
|
250
250
|
trackedTable.link_descriptor.fromModel &&
|
251
251
|
entity.linkDescriptor.toModel ===
|
252
252
|
trackedTable.link_descriptor.toModel &&
|
253
|
-
entity.linkDescriptor.fromModule ===
|
254
|
-
trackedTable.link_descriptor.fromModule &&
|
255
|
-
entity.linkDescriptor.toModule ===
|
256
|
-
trackedTable.link_descriptor.toModule);
|
257
|
-
})
|
253
|
+
entity.linkDescriptor.fromModule.toLowerCase() ===
|
254
|
+
trackedTable.link_descriptor.fromModule.toLowerCase() &&
|
255
|
+
entity.linkDescriptor.toModule.toLowerCase() ===
|
256
|
+
trackedTable.link_descriptor.toModule.toLowerCase());
|
257
|
+
});
|
258
|
+
const newTableName = linkEntity?.entity.meta.collection;
|
258
259
|
/**
|
259
260
|
* Perform rename
|
260
261
|
*/
|
261
262
|
if (newTableName && trackedTable.table_name !== newTableName) {
|
262
|
-
await this.renameOldTable(orm, trackedTable.table_name, newTableName);
|
263
|
+
await this.renameOldTable(orm, trackedTable.table_name, newTableName, linkEntity.linkDescriptor);
|
263
264
|
migratedTables.push({
|
264
265
|
...trackedTable,
|
265
266
|
table_name: newTableName,
|
@@ -276,10 +277,10 @@ class MigrationsExecutionPlanner {
|
|
276
277
|
/**
|
277
278
|
* Renames existing table and also its tracked entry
|
278
279
|
*/
|
279
|
-
async renameOldTable(orm, oldName, newName) {
|
280
|
+
async renameOldTable(orm, oldName, newName, descriptor) {
|
280
281
|
await orm.em.getDriver().getConnection().execute(`
|
281
282
|
ALTER TABLE "${oldName}" RENAME TO "${newName}";
|
282
|
-
UPDATE "${this.tableName}" SET table_name = '${newName}' WHERE table_name = '${oldName}';
|
283
|
+
UPDATE "${this.tableName}" SET table_name = '${newName}', link_descriptor = '${JSON.stringify(descriptor)}' WHERE table_name = '${oldName}';
|
283
284
|
`);
|
284
285
|
}
|
285
286
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,qDAMkC;AAElC,sDAAwE;AACxE,oCAAyC;AAEzC;;;;GAIG;AACH,MAAa,0BAA0B;IA0BrC,YACE,YAAkC,EAClC,OAAwC;QA3B1C;;WAEG;QACH,uDAAgE;QAEhE;;;WAGG;QACH,wDAAqB,CAAC,cAAc,EAAE,aAAa,CAAC;QAEpD;;WAEG;UAJiD;QAEpD;;WAEG;QACH,4DAGG;QAEH;;;WAGG;QACO,cAAS,GAAG,wBAAwB,CAAA;QAM5C,uBAAA,IAAI,wCAAa,uBAAe,CAAC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cD,gEA8cC"}
|
@@ -16,7 +16,7 @@ function getClass(...properties) {
|
|
16
16
|
function generateEntity(joinerConfig, primary, foreign) {
|
17
17
|
const fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey);
|
18
18
|
const tableName = joinerConfig.databaseConfig?.tableName ??
|
19
|
-
(0, utils_1.composeTableName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey);
|
19
|
+
(0, utils_1.composeTableName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey).toLowerCase();
|
20
20
|
const fields = fieldNames.reduce((acc, curr) => {
|
21
21
|
acc[curr] = {
|
22
22
|
type: "string",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate-entity.js","sourceRoot":"","sources":["../../src/utils/generate-entity.ts"],"names":[],"mappings":";;AAwBA,wCAgGC;AApHD,qDAKkC;AAElC,0CAA8C;AAC9C,mDAA8C;AAE9C,SAAS,QAAQ,CAAC,GAAG,UAAU;IAC7B,OAAO,MAAM,SAAS;QACpB,YAAY,GAAG,MAAM;YACnB,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;gBAC/B,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;YAC1B,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAgB,cAAc,CAC5B,YAAgC,EAChC,OAA2B,EAC3B,OAA2B;IAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE3E,MAAM,SAAS,GACb,YAAY,CAAC,cAAc,EAAE,SAAS;QACtC,IAAA,wBAAgB,EACd,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,CACnB,CAAA;
|
1
|
+
{"version":3,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AG,aAAa;aAChC;YACD;gBACE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;gBACzC,IAAI,EACF,MAAM;oBACN,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;oBACvC,GAAG;oBACH,aAAa;aAChB;YACD;gBACE,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,GAAG,GAAG,aAAa;aACxD;YACD;gBACE,UAAU,EAAE,CAAC,YAAY,CAAC;gBAC1B,IAAI,EAAE,iBAAiB,GAAG,aAAa;aACxC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/link-modules",
|
3
|
-
"version": "1.0.0-rc-
|
3
|
+
"version": "1.0.0-rc-20241014151055",
|
4
4
|
"description": "Medusa Default Link Modules Package and Definitions",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
|
-
"@medusajs/framework": "1.0.0-rc-
|
36
|
+
"@medusajs/framework": "1.0.0-rc-20241014151055",
|
37
37
|
"@mikro-orm/core": "5.9.7",
|
38
38
|
"@mikro-orm/migrations": "5.9.7",
|
39
39
|
"@mikro-orm/postgresql": "5.9.7",
|
@@ -41,13 +41,13 @@
|
|
41
41
|
"@swc/jest": "^0.2.36",
|
42
42
|
"cross-env": "^5.2.1",
|
43
43
|
"jest": "^29.7.0",
|
44
|
-
"medusa-test-utils": "2.0.0-rc-
|
44
|
+
"medusa-test-utils": "2.0.0-rc-20241014151055",
|
45
45
|
"rimraf": "^5.0.1",
|
46
46
|
"tsc-alias": "^1.8.6",
|
47
47
|
"typescript": "^5.6.2"
|
48
48
|
},
|
49
49
|
"peerDependencies": {
|
50
|
-
"@medusajs/framework": "1.0.0-rc-
|
50
|
+
"@medusajs/framework": "1.0.0-rc-20241014151055",
|
51
51
|
"@mikro-orm/core": "5.9.7",
|
52
52
|
"@mikro-orm/migrations": "5.9.7",
|
53
53
|
"@mikro-orm/postgresql": "5.9.7",
|