@strapi/database 5.0.0-beta.5 → 5.0.0-beta.6

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/index.mjs CHANGED
@@ -5986,15 +5986,13 @@ const migrateDocumentIdsWithLocalizations = async (db, knex2, meta) => {
5986
5986
  } while (ids.length > 0);
5987
5987
  };
5988
5988
  const migrationDocumentIds = async (db, knex2, meta) => {
5989
- let run = true;
5989
+ let updatedRows;
5990
5990
  do {
5991
- const updatedRows = await knex2(meta.tableName).update({ document_id: createId() }).whereIn("id", (builder) => {
5992
- return builder.whereNull("document_id").select("id").limit(1);
5993
- });
5994
- if (updatedRows <= 0) {
5995
- run = false;
5996
- }
5997
- } while (run);
5991
+ updatedRows = await knex2(meta.tableName).update({ document_id: createId() }).whereIn(
5992
+ "id",
5993
+ knex2(meta.tableName).select("id").from(knex2(meta.tableName).select("id").whereNull("document_id").limit(1).as("sub_query"))
5994
+ );
5995
+ } while (updatedRows > 0);
5998
5996
  };
5999
5997
  const createDocumentIdColumn = async (knex2, tableName) => {
6000
5998
  await knex2.schema.alterTable(tableName, (table) => {