@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.js CHANGED
@@ -6018,15 +6018,13 @@ const migrateDocumentIdsWithLocalizations = async (db, knex2, meta) => {
6018
6018
  } while (ids.length > 0);
6019
6019
  };
6020
6020
  const migrationDocumentIds = async (db, knex2, meta) => {
6021
- let run = true;
6021
+ let updatedRows;
6022
6022
  do {
6023
- const updatedRows = await knex2(meta.tableName).update({ document_id: cuid2.createId() }).whereIn("id", (builder) => {
6024
- return builder.whereNull("document_id").select("id").limit(1);
6025
- });
6026
- if (updatedRows <= 0) {
6027
- run = false;
6028
- }
6029
- } while (run);
6023
+ updatedRows = await knex2(meta.tableName).update({ document_id: cuid2.createId() }).whereIn(
6024
+ "id",
6025
+ knex2(meta.tableName).select("id").from(knex2(meta.tableName).select("id").whereNull("document_id").limit(1).as("sub_query"))
6026
+ );
6027
+ } while (updatedRows > 0);
6030
6028
  };
6031
6029
  const createDocumentIdColumn = async (knex2, tableName) => {
6032
6030
  await knex2.schema.alterTable(tableName, (table) => {