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

fix: add unique position contraint as deferred #330

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

pratikmishra356
Copy link
Collaborator

Problem

During position update statement , we increment/decrement the values , which conflicts with the unique constraint within the transaction

Solution

Making constraint as deferred which validates on transaction commit instead of statement

Environment variable changes

What ENVs need to be added or changed

Pre-deployment activity

Things needed to be done before deploying this change (if any)

Post-deployment activity

Things needed to be done after deploying this change (if any)

API changes

Endpoint Method Request body Response Body
API GET/POST, etc request response

Possible Issues in the future

Describe any possible issues that could occur because of this change

@pratikmishra356 pratikmishra356 requested a review from a team as a code owner January 2, 2025 12:31
ADD CONSTRAINT dimension_unique_position UNIQUE (position) DEFERRABLE INITIALLY IMMEDIATE;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Guess you can make a new migration file for this one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mahatoankitkumar no need to make a new migration for this , its just a minor upgradation in the constraint

@pratikmishra356 pratikmishra356 merged commit 2f507df into main Jan 3, 2025
4 checks passed
@pratikmishra356 pratikmishra356 deleted the position-db-fix branch January 3, 2025 07:47
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.

3 participants