@strapi/database 5.0.0-beta.3 → 5.0.0-beta.5
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/entity-manager/morph-relations.d.ts +1 -1
- package/dist/entity-manager/morph-relations.d.ts.map +1 -1
- package/dist/entity-manager/regular-relations.d.ts +8 -8
- package/dist/entity-manager/regular-relations.d.ts.map +1 -1
- package/dist/entity-manager/relations-orderer.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/common.d.ts +16 -2
- package/dist/migrations/common.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +2 -2
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/internal.d.ts +2 -2
- package/dist/migrations/internal.d.ts.map +1 -1
- package/dist/migrations/storage.d.ts.map +1 -1
- package/dist/migrations/users.d.ts +2 -2
- package/dist/migrations/users.d.ts.map +1 -1
- package/dist/transaction-context.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -5856,7 +5856,7 @@ const createStorage = (opts) => {
|
|
|
5856
5856
|
};
|
|
5857
5857
|
};
|
|
5858
5858
|
const wrapTransaction = (db) => (fn) => () => {
|
|
5859
|
-
return db.
|
|
5859
|
+
return db.transaction(({ trx }) => Promise.resolve(fn(trx, db)));
|
|
5860
5860
|
};
|
|
5861
5861
|
const migrationResolver = ({ name, path: path2, context }) => {
|
|
5862
5862
|
const { db } = context;
|
|
@@ -6182,11 +6182,12 @@ const internalMigrations = [
|
|
|
6182
6182
|
];
|
|
6183
6183
|
const createInternalMigrationProvider = (db) => {
|
|
6184
6184
|
const context = { db };
|
|
6185
|
+
const migrations = [...internalMigrations];
|
|
6185
6186
|
const umzugProvider = new Umzug({
|
|
6186
6187
|
storage: createStorage({ db, tableName: "strapi_migrations_internal" }),
|
|
6187
6188
|
logger: console,
|
|
6188
6189
|
context,
|
|
6189
|
-
migrations:
|
|
6190
|
+
migrations: () => migrations.map((migration) => {
|
|
6190
6191
|
return {
|
|
6191
6192
|
name: migration.name,
|
|
6192
6193
|
up: wrapTransaction(context.db)(migration.up),
|
|
@@ -6195,6 +6196,9 @@ const createInternalMigrationProvider = (db) => {
|
|
|
6195
6196
|
})
|
|
6196
6197
|
});
|
|
6197
6198
|
return {
|
|
6199
|
+
async register(migration) {
|
|
6200
|
+
migrations.push(migration);
|
|
6201
|
+
},
|
|
6198
6202
|
async shouldRun() {
|
|
6199
6203
|
const pendingMigrations = await umzugProvider.pending();
|
|
6200
6204
|
return pendingMigrations.length > 0;
|
|
@@ -6208,8 +6212,13 @@ const createInternalMigrationProvider = (db) => {
|
|
|
6208
6212
|
};
|
|
6209
6213
|
};
|
|
6210
6214
|
const createMigrationsProvider = (db) => {
|
|
6211
|
-
const
|
|
6215
|
+
const userProvider = createUserMigrationProvider(db);
|
|
6216
|
+
const internalProvider = createInternalMigrationProvider(db);
|
|
6217
|
+
const providers = [userProvider, internalProvider];
|
|
6212
6218
|
return {
|
|
6219
|
+
providers: {
|
|
6220
|
+
internal: internalProvider
|
|
6221
|
+
},
|
|
6213
6222
|
async shouldRun() {
|
|
6214
6223
|
const shouldRunResponses = await Promise.all(
|
|
6215
6224
|
providers.map((provider) => provider.shouldRun())
|