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

Allow destroying promotions #25

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Oct 11, 2023

Currently, promotions cannot be destroyed as soon as the have dependent records. This sets dependent: :destroy on all important relations except for actions, which are soft-deletable, and thus need to be nullified instead.

Alternatively, we could make all tables soft-deleteable, which would be better for auditing. If a promotion gets applied, and we have an adjustment with a promotion action as its source, and then we delete the promotion action's promotion, we will end up with an "orphan" promotion action.

Promotion actions need to be soft-deleteable, because if they are deleted, they might nullify - or worse - delete adjustments on orders.

Currently, promotions cannot be destroyed as soon as the have dependent
records. This sets `dependent: :destroy` on all important relations
except for `actions`, which are soft-deletable, and thus need to be
nullified instead.

Alternatively, we could make all tables soft-deleteable, which would be
better for auditing. If a promotion gets applied, and we have an
adjustment with a promotion action as its source, and then we delete the
promotion action's promotion, we will end up with an "orphan" promotion
action.

Promotion actions need to be soft-deleteable, because if they are
deleted, they might nullify - or worse - delete adjustments on orders.
Copy link
Collaborator

@davecandlescience davecandlescience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the long term should/must be soft delete on all of these entities. There are too many ties to other objects once these get used on an order.

@mamhoff mamhoff merged commit 8ce4c09 into main Oct 12, 2023
@mamhoff mamhoff deleted the nullify-promotion-actions-promotion-ids branch October 12, 2023 15:17
mamhoff added a commit that referenced this pull request Jul 1, 2024
mamhoff added a commit that referenced this pull request Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants