Skip to content

Commit

Permalink
feat: add index to contract_analyzed
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid committed Dec 3, 2024
1 parent 4a067e2 commit 54574b1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/cell_dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def self.parse_cell_dpes_from_ckb_transaction(ckb_transaction, cell_deps)
# Indexes
#
# index_cell_dependencies_on_block_number_and_tx_index (block_number,tx_index)
# index_cell_dependencies_on_contract_analyzed (contract_analyzed)
# index_cell_dependencies_on_tx_id_and_cell_id_and_dep_type (ckb_transaction_id,contract_cell_id,dep_type) UNIQUE
# index_on_cell_dependencies_contract_cell_block_tx (contract_cell_id,block_number DESC,tx_index DESC)
#
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddContractAnalyzedIndexToCellDependency < ActiveRecord::Migration[7.0]
def change
add_index :cell_dependencies, :contract_analyzed
end
end
12 changes: 11 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4667,6 +4667,13 @@ CREATE INDEX index_blocks_on_timestamp ON public.blocks USING btree ("timestamp"
CREATE INDEX index_cell_dependencies_on_block_number_and_tx_index ON public.cell_dependencies USING btree (block_number, tx_index);


--
-- Name: index_cell_dependencies_on_contract_analyzed; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_dependencies_on_contract_analyzed ON public.cell_dependencies USING btree (contract_analyzed);


--
-- Name: index_cell_dependencies_on_tx_id_and_cell_id_and_dep_type; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -6017,5 +6024,8 @@ INSERT INTO "schema_migrations" (version) VALUES
('20241114074433'),
('20241119014652'),
('20241121073245'),
('20241202072604');
('20241125100650');
('20241129000339');
('20241202072604');


0 comments on commit 54574b1

Please sign in to comment.