Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SalesOrder Data Migration #8585

Merged

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed migration Data or schema migrations labels Nov 28, 2024
@SchrodingersGat SchrodingersGat added this to the 0.17.0 milestone Nov 28, 2024
Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit c89fbe0
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/6758314353891b00088f3434
😎 Deploy Preview https://deploy-preview-8585--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 57.89474% with 8 lines in your changes missing coverage. Please review.

Project coverage is 84.73%. Comparing base (4a8cb6f) to head (c89fbe0).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...enTree/order/migrations/0105_auto_20241128_0431.py 57.89% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8585      +/-   ##
==========================================
+ Coverage   84.61%   84.73%   +0.12%     
==========================================
  Files        1190     1191       +1     
  Lines       54299    54318      +19     
  Branches     2057     2057              
==========================================
+ Hits        45946    46028      +82     
+ Misses       7843     7771      -72     
- Partials      510      519       +9     
Flag Coverage Δ
backend 86.05% <57.89%> (-0.02%) ⬇️
migrations 42.64% <57.89%> (+<0.01%) ⬆️
pui 69.69% <ø> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SchrodingersGat SchrodingersGat added the full-run Always do a full QC CI run label Nov 28, 2024
@SchrodingersGat
Copy link
Member Author

@matmair a bit of a strange one here. I am adding some data migration tests, and coming across a strange error related to the new custom status codes:

From https://github.com/inventree/InvenTree/actions/runs/12076386849/job/33677691064?pr=8585

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django_test_migrations/contrib/unittest_case.py", line 40, in setUp
    self.prepare()
  File "/home/runner/work/InvenTree/InvenTree/src/backend/InvenTree/order/test_migrations.py", line 243, in prepare
    order = SalesOrder.objects.create(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/query.py", line 658, in create
    obj.save(force_insert=True, using=self.db)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/base.py", line 814, in save
    self.save_base(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/base.py", line 877, in save_base
    updated = self._save_table(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/base.py", line 1020, in _save_table
    results = self._do_insert(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/base.py", line 1061, in _do_insert
    return manager._insert(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/query.py", line 1805, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql
    cursor.execute(sql, params)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)
django.db.utils.ProgrammingError: column "status_custom_key" specified more than once
LINE 1: ...der_currency", "address_id", "status_custom_key", "status_cu...

Any thoughts on this one? I have not been able to track it down. But it is adding the status_custom_key field to the model multiple times, for some reason?

@matmair
Copy link
Member

matmair commented Nov 29, 2024

@SchrodingersGat that seems to be very low level in the ORM, that will need need some time to debug; will try to ding into it over the weekend

@matmair
Copy link
Member

matmair commented Dec 2, 2024

No idea what is causing this; is this also reproducible with normal migrations?

@SchrodingersGat
Copy link
Member Author

This is the first (and only) time I have seen this

@SchrodingersGat SchrodingersGat merged commit 3554429 into inventree:master Dec 10, 2024
27 checks passed
@SchrodingersGat SchrodingersGat deleted the so-shipment-migration branch December 10, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed full-run Always do a full QC CI run migration Data or schema migrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants