-
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.
chore: set statement_timeout for migration
Signed-off-by: Miles Zhang <[email protected]>
- Loading branch information
1 parent
54574b1
commit f886b3e
Showing
8 changed files
with
15 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
class AddUniqueIndexToLockScript < ActiveRecord::Migration[7.0] | ||
def up | ||
def change | ||
# set 1 hour | ||
execute "SET statement_timeout = 3600000" | ||
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" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
class AddUniqueIndexToTypeScript < ActiveRecord::Migration[7.0] | ||
def up | ||
def change | ||
# set 1 hour | ||
execute "SET statement_timeout = 3600000" | ||
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" | ||
execute "RESET statement_timeout;" | ||
end | ||
end |
3 changes: 2 additions & 1 deletion
3
db/migrate/20240904043807_change_ckb_transaction_confirmation_time.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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class ChangeCkbTransactionConfirmationTime < ActiveRecord::Migration[7.0] | ||
def change | ||
ActiveRecord::Base.connection.execute("SET statement_timeout = 0") | ||
execute("SET statement_timeout = 0;") | ||
change_column :ckb_transactions, :confirmation_time, :bigint | ||
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
3 changes: 2 additions & 1 deletion
3
db/migrate/20241121073245_add_sorted_index_to_cell_dependencies.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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
class AddSortedIndexToCellDependencies < ActiveRecord::Migration[7.0] | ||
def change | ||
ActiveRecord::Base.connection.execute("SET statement_timeout = 0") | ||
execute("SET statement_timeout = 0;") | ||
|
||
remove_index :cell_dependencies, column: :contract_cell_id | ||
add_index :cell_dependencies, %i[contract_cell_id block_number tx_index], | ||
order: { block_number: :desc, tx_index: :desc }, | ||
name: "index_on_cell_dependencies_contract_cell_block_tx" | ||
execute "RESET statement_timeout;" | ||
end | ||
end |
1 change: 0 additions & 1 deletion
1
db/migrate/20241125100650_add_contract_analyzed_to_cell_dependency.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
class AddContractAnalyzedToCellDependency < ActiveRecord::Migration[7.0] | ||
def change | ||
ActiveRecord::Base.connection.execute("SET statement_timeout = 0") | ||
add_column :cell_dependencies, :contract_analyzed, :boolean, default: false | ||
end | ||
end |
2 changes: 2 additions & 0 deletions
2
db/migrate/20241129000339_add_contract_analyzed_index_to_cell_dependency.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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
class AddContractAnalyzedIndexToCellDependency < ActiveRecord::Migration[7.0] | ||
def change | ||
execute("SET statement_timeout = 0;") | ||
add_index :cell_dependencies, :contract_analyzed | ||
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