-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Fixes Rails/UniqueValidationWithoutIndex (part of #11482) #13163
Open
cyrillefr
wants to merge
2
commits into
openfoodfoundation:master
Choose a base branch
from
cyrillefr:FixRailsUniqueValidationWithoutIndex
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions
8
db/migrate/20250214192930_add_unique_index_email_entreprise_to_customers.rb
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,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexEmailEntrepriseToCustomers < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_index :customers, :email, name: :index_customers_on_email | ||
add_index(:customers, [:email, :enterprise_id], unique: true) | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
db/migrate/20250214200526_add_unique_index_sender_id_and_others_to_exchanges.rb
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexSenderIdAndOthersToExchanges < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_index :exchanges, :sender_id, name: :index_exchanges_on_sender_id | ||
add_index(:exchanges, [:sender_id, :order_cycle_id, :receiver_id, :incoming], | ||
unique: true, name: :index_exchanges_on_sender_id) | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
db/migrate/20250215083320_add_unique_index_variant_id_and_deleted_at_to_stock_items.rb
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,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexVariantIdAndDeletedAtToStockItems < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_index :spree_stock_items, :variant_id, name: :index_spree_stock_items_on_variant_id | ||
add_index(:spree_stock_items, [:variant_id, :deleted_at], unique: true) | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20250215085838_add_unique_index_name_and_deleted_at_to_tax_categories.rb
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexNameAndDeletedAtToTaxCategories < ActiveRecord::Migration[7.0] | ||
def change | ||
add_index(:spree_tax_categories, [:name, :deleted_at], unique: true) | ||
end | ||
end |
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUniqueIndexNameToZones < ActiveRecord::Migration[7.0] | ||
def change | ||
add_index(:spree_zones, :name, unique: true) | ||
end | ||
end |
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
Oops, something went wrong.
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.
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.
We have some offenders here, too:
Those numbers are small enough to resolve manually, I think.
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.
We have four servers to resolve:
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.
I had a look at openfoodnetwork.ie and the duplicate exchange has been created 100ms after the first one. I'm not sure where the glitch is. Maybe something in the Javascript sending two items? They are exactly the same. So I can delete one.