diff --git a/cookbook/migrations/0220_shoppinglistrecipe_created_by_and_more.py b/cookbook/migrations/0220_shoppinglistrecipe_created_by_and_more.py index c8dac6ed9..4ebbbc1f9 100644 --- a/cookbook/migrations/0220_shoppinglistrecipe_created_by_and_more.py +++ b/cookbook/migrations/0220_shoppinglistrecipe_created_by_and_more.py @@ -3,34 +3,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -from django.db.models import F, Count -from django_scopes import scopes_disabled - - -def add_space_and_owner_to_shopping_list_recipe(apps, schema_editor): - print('migrating shopping list recipe space attribute, this might take a while ...') - with scopes_disabled(): - ShoppingListRecipe = apps.get_model('cookbook', 'ShoppingListRecipe') - - # delete all shopping list recipes that do not have entries as those are of no use anyway - ShoppingListRecipe.objects.annotate(entry_count=Count('entries')).filter(entry_count__lte=0).delete() - - shopping_list_recipes = ShoppingListRecipe.objects.all().prefetch_related('entries') - update_list = [] - - for slr in shopping_list_recipes: - if entry := slr.entries.first(): - if entry.space and entry.created_by: - slr.space = entry.space - slr.created_by = entry.created_by - update_list.append(slr) - else: - print(slr, 'missing data on entry') - else: - print(slr, 'missing entry') - - ShoppingListRecipe.objects.bulk_update(update_list, ['space', 'created_by'], batch_size=500) - class Migration(migrations.Migration): dependencies = [ @@ -49,5 +21,4 @@ class Migration(migrations.Migration): name='space', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'), ), - migrations.RunPython(add_space_and_owner_to_shopping_list_recipe), ] diff --git a/cookbook/migrations/0221_migrate_shoppinglistrecipe_space_created_by.py b/cookbook/migrations/0221_migrate_shoppinglistrecipe_space_created_by.py new file mode 100644 index 000000000..22323696c --- /dev/null +++ b/cookbook/migrations/0221_migrate_shoppinglistrecipe_space_created_by.py @@ -0,0 +1,42 @@ +# Generated by Django 4.2.18 on 2025-03-14 10:50 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +from django.db.models import F, Count +from django_scopes import scopes_disabled + + +def add_space_and_owner_to_shopping_list_recipe(apps, schema_editor): + print('migrating shopping list recipe space attribute, this might take a while ...') + with scopes_disabled(): + ShoppingListRecipe = apps.get_model('cookbook', 'ShoppingListRecipe') + + # delete all shopping list recipes that do not have entries as those are of no use anyway + ShoppingListRecipe.objects.annotate(entry_count=Count('entries')).filter(entry_count__lte=0).delete() + + shopping_list_recipes = ShoppingListRecipe.objects.all().prefetch_related('entries') + update_list = [] + + for slr in shopping_list_recipes: + if entry := slr.entries.first(): + if entry.space and entry.created_by: + slr.space = entry.space + slr.created_by = entry.created_by + update_list.append(slr) + else: + print(slr, 'missing data on entry') + else: + print(slr, 'missing entry') + + ShoppingListRecipe.objects.bulk_update(update_list, ['space', 'created_by'], batch_size=500) + + +class Migration(migrations.Migration): + dependencies = [ + ('cookbook', '0220_shoppinglistrecipe_created_by_and_more'), + ] + + operations = [ + migrations.RunPython(add_space_and_owner_to_shopping_list_recipe), + ] diff --git a/cookbook/migrations/0221_alter_shoppinglistrecipe_created_by_and_more.py b/cookbook/migrations/0222_alter_shoppinglistrecipe_created_by_and_more.py similarity index 91% rename from cookbook/migrations/0221_alter_shoppinglistrecipe_created_by_and_more.py rename to cookbook/migrations/0222_alter_shoppinglistrecipe_created_by_and_more.py index a27f7ad34..199f893f5 100644 --- a/cookbook/migrations/0221_alter_shoppinglistrecipe_created_by_and_more.py +++ b/cookbook/migrations/0222_alter_shoppinglistrecipe_created_by_and_more.py @@ -9,7 +9,7 @@ class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('cookbook', '0220_shoppinglistrecipe_created_by_and_more'), + ('cookbook', '0221_migrate_shoppinglistrecipe_space_created_by'), ] operations = [ diff --git a/vue/yarn.lock b/vue/yarn.lock index 78658ef14..a39aaf1c6 100644 --- a/vue/yarn.lock +++ b/vue/yarn.lock @@ -156,6 +156,15 @@ "@babel/highlight" "^7.22.13" chalk "^2.4.2" +"@babel/code-frame@^7.26.2": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": version "7.22.9" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" @@ -385,6 +394,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + "@babel/helper-validator-identifier@^7.22.15", "@babel/helper-validator-identifier@^7.22.5": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz#601fa28e4cc06786c18912dca138cec73b882044" @@ -395,6 +409,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + "@babel/helper-validator-option@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040" @@ -410,13 +429,12 @@ "@babel/types" "^7.22.17" "@babel/helpers@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.15.tgz#f09c3df31e86e3ea0b7ff7556d85cdebd47ea6f1" - integrity sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw== + version "7.26.10" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.10.tgz#6baea3cd62ec2d0c1068778d63cb1314f6637384" + integrity sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g== dependencies: - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.22.15" - "@babel/types" "^7.22.15" + "@babel/template" "^7.26.9" + "@babel/types" "^7.26.10" "@babel/highlight@^7.22.13": version "7.22.13" @@ -437,6 +455,13 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== +"@babel/parser@^7.26.9": + version "7.26.10" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.10.tgz#e9bdb82f14b97df6569b0b038edd436839c57749" + integrity sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA== + dependencies: + "@babel/types" "^7.26.10" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.15.tgz#02dc8a03f613ed5fdc29fb2f728397c78146c962" @@ -1199,9 +1224,9 @@ integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8" - integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA== + version "7.26.10" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.10.tgz#a07b4d8fa27af131a633d7b3524db803eb4764c2" + integrity sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw== dependencies: regenerator-runtime "^0.14.0" @@ -1214,7 +1239,16 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" -"@babel/traverse@^7.22.15", "@babel/traverse@^7.22.17", "@babel/traverse@^7.22.5", "@babel/traverse@^7.7.0": +"@babel/template@^7.26.9": + version "7.26.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2" + integrity sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA== + dependencies: + "@babel/code-frame" "^7.26.2" + "@babel/parser" "^7.26.9" + "@babel/types" "^7.26.9" + +"@babel/traverse@^7.22.17", "@babel/traverse@^7.22.5", "@babel/traverse@^7.7.0": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== @@ -1248,6 +1282,14 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@babel/types@^7.26.10", "@babel/types@^7.26.9": + version "7.26.10" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.10.tgz#396382f6335bd4feb65741eacfc808218f859259" + integrity sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@codemirror/autocomplete@^6.0.0", "@codemirror/autocomplete@^6.13.0", "@codemirror/autocomplete@^6.7.1": version "6.13.0" resolved "https://registry.yarnpkg.com/@codemirror/autocomplete/-/autocomplete-6.13.0.tgz#fa7df3b2809863df0da4556f72ac4263ea4d7adb"