-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ProgressiveBilling): Usage threshold should be soft deleted
- Loading branch information
1 parent
e30357d
commit 1dc366a
Showing
5 changed files
with
31 additions
and
4 deletions.
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
13 changes: 13 additions & 0 deletions
13
db/migrate/20240819092354_add_deleted_at_to_usage_thresholds.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,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class ¨ < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :usage_thresholds, :deleted_at, :datetime | ||
|
||
remove_index :usage_thresholds, %i[amount_cents plan_id recurring], unique: true | ||
remove_index :usage_thresholds, %i[plan_id recurring], unique: true, where: "recurring is true" | ||
|
||
add_index :usage_thresholds, %i[amount_cents plan_id recurring], unique: true, where: 'deleted_at IS NULL' | ||
add_index :usage_thresholds, %i[plan_id recurring], unique: true, where: "recurring is true and deleted_at IS NULL" | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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