-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 proper unique constraints and remove soft deletion from models #7098
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
faa1da0
Remove soft deletion for custom_forms and event_sub_topics
Haider8 bb4c74c
fix deepsource issue unused import
Haider8 93c649c
Add soft deletion and deleted_at unique constraint
Haider8 c120d2a
Remove deleted_at from constraint name
Haider8 8d22f7e
Merge branch 'development' of https://github.com/fossasia/open-event-…
Haider8 01d308a
Merge branch 'development' of https://github.com/fossasia/open-event-…
Haider8 08f153e
Remove deleted_at from custom_form query filter
Haider8 88bb9c4
Remove soft deleted schema and deleted_at from query
Haider8 aee231c
Remove soft deletion schema for event sub-topic
Haider8 4393a56
fix dredd api tests
Haider8 85cc1ad
Add row delete query in alembic upgrade method
Haider8 6eb0aff
Remove soft deletion from TicketFees model
Haider8 1574bbc
Remove soft deletion from Permission model
Haider8 2787ed9
Merge branch 'development' into issue-7093
iamareebjamal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
migrations/versions/rev-2020-06-30-20:07:55-f177c14710f1_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""empty message | ||
|
||
Revision ID: f177c14710f1 | ||
Revises: 64439b77fa6d | ||
Create Date: 2020-06-30 20:07:55.320285 | ||
|
||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
import sqlalchemy_utils | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'f177c14710f1' | ||
down_revision = '64439b77fa6d' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute('DELETE FROM custom_forms WHERE deleted_at IS NOT NULL') | ||
op.execute('DELETE FROM event_sub_topics WHERE deleted_at IS NOT NULL') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, you can't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What will be the equivalent? |
||
|
||
op.drop_column('custom_forms', 'deleted_at') | ||
op.drop_column('event_sub_topics', 'deleted_at') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('event_sub_topics', sa.Column('deleted_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True)) | ||
op.add_column('custom_forms', sa.Column('deleted_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True)) | ||
# ### end Alembic commands ### |
34 changes: 34 additions & 0 deletions
34
migrations/versions/rev-2020-07-03-02:08:01-321c0bf9a52d_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""empty message | ||
|
||
Revision ID: 321c0bf9a52d | ||
Revises: f177c14710f1 | ||
Create Date: 2020-07-03 02:08:01.440819 | ||
|
||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
import sqlalchemy_utils | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '321c0bf9a52d' | ||
down_revision = 'f177c14710f1' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('uq_event_discount_code', 'discount_codes', type_='unique') | ||
op.create_unique_constraint('uq_event_discount_code', 'discount_codes', ['event_id', 'code', 'deleted_at']) | ||
op.drop_constraint('email_role_event_uc', 'role_invites', type_='unique') | ||
op.create_unique_constraint('email_role_event_uc', 'role_invites', ['email', 'role_id', 'event_id', 'deleted_at']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('email_role_event_uc', 'role_invites', type_='unique') | ||
op.create_unique_constraint('email_role_event_uc', 'role_invites', ['email', 'role_id', 'event_id']) | ||
op.drop_constraint('uq_event_discount_code', 'discount_codes', type_='unique') | ||
op.create_unique_constraint('uq_event_discount_code', 'discount_codes', ['event_id', 'code']) | ||
# ### end Alembic commands ### |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black would make changes.