-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add unique index to lock_scripts and type_scripts Signed-off-by: Miles Zhang <[email protected]> * fix: use upsert_all to save lock_script and type_script Signed-off-by: Miles Zhang <[email protected]> * test: fix test Signed-off-by: Miles Zhang <[email protected]> --------- Signed-off-by: Miles Zhang <[email protected]>
- Loading branch information
1 parent
1901d01
commit 43dc3e9
Showing
9 changed files
with
55 additions
and
65 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
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/20240823071323_add_unique_index_to_lock_script.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 @@ | ||
class AddUniqueIndexToLockScript < ActiveRecord::Migration[7.0] | ||
def up | ||
# set 1 hour | ||
execute "SET statement_timeout = 3600000" | ||
|
||
remove_index :lock_scripts, :script_hash | ||
add_index :lock_scripts, :script_hash, unique: true | ||
end | ||
|
||
def down | ||
execute "RESET statement_timeout" | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
db/migrate/20240823071420_add_unique_index_to_type_script.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 @@ | ||
class AddUniqueIndexToTypeScript < ActiveRecord::Migration[7.0] | ||
def up | ||
# set 1 hour | ||
execute "SET statement_timeout = 3600000" | ||
|
||
remove_index :type_scripts, :script_hash | ||
add_index :type_scripts, :script_hash, unique: true | ||
end | ||
|
||
def down | ||
execute "RESET statement_timeout" | ||
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
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