Skip to content

Commit d203b81

Browse files
authored
Merge pull request #2670 from nervosnetwork/testnet
Deploy to mainnet
2 parents d1ce815 + 4328579 commit d203b81

File tree

3 files changed

+76
-6
lines changed

3 files changed

+76
-6
lines changed

app/models/ckb_transaction.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ def recover_dead_cell
258258
#
259259
# Indexes
260260
#
261-
# ckb_tx_uni_tx_hash (tx_status,tx_hash) UNIQUE
262-
# idx_ckb_txs_for_blocks (block_id,block_timestamp)
263-
# idx_ckb_txs_timestamp (block_timestamp DESC NULLS LAST,id)
264-
# index_ckb_transactions_on_tags (tags) USING gin
265-
# index_ckb_transactions_on_tx_hash (tx_hash) USING hash
261+
# ckb_tx_uni_tx_hash (tx_status,tx_hash) UNIQUE
262+
# idx_ckb_txs_for_blocks (block_id,block_timestamp)
263+
# idx_ckb_txs_timestamp (block_timestamp DESC NULLS LAST,id)
264+
# index_ckb_transactions_on_block_number (block_number)
265+
# index_ckb_transactions_on_tags (tags) USING gin
266+
# index_ckb_transactions_on_tx_hash (tx_hash) USING hash
266267
#
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddBlockNumberIndexToCkbTransactions < ActiveRecord::Migration[7.0]
2+
def change
3+
add_index :ckb_transactions, :block_number
4+
end
5+
end

db/structure.sql

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4118,6 +4118,20 @@ CREATE INDEX idx_ckb_txs_for_blocks ON ONLY public.ckb_transactions USING btree
41184118
CREATE INDEX ckb_transactions_committed_block_id_block_timestamp_idx ON public.ckb_transactions_committed USING btree (block_id, block_timestamp);
41194119

41204120

4121+
--
4122+
-- Name: index_ckb_transactions_on_block_number; Type: INDEX; Schema: public; Owner: -
4123+
--
4124+
4125+
CREATE INDEX index_ckb_transactions_on_block_number ON ONLY public.ckb_transactions USING btree (block_number);
4126+
4127+
4128+
--
4129+
-- Name: ckb_transactions_committed_block_number_idx; Type: INDEX; Schema: public; Owner: -
4130+
--
4131+
4132+
CREATE INDEX ckb_transactions_committed_block_number_idx ON public.ckb_transactions_committed USING btree (block_number);
4133+
4134+
41214135
--
41224136
-- Name: idx_ckb_txs_timestamp; Type: INDEX; Schema: public; Owner: -
41234137
--
@@ -4167,6 +4181,13 @@ CREATE INDEX ckb_transactions_committed_tx_hash_idx ON public.ckb_transactions_c
41674181
CREATE INDEX ckb_transactions_pending_block_id_block_timestamp_idx ON public.ckb_transactions_pending USING btree (block_id, block_timestamp);
41684182

41694183

4184+
--
4185+
-- Name: ckb_transactions_pending_block_number_idx; Type: INDEX; Schema: public; Owner: -
4186+
--
4187+
4188+
CREATE INDEX ckb_transactions_pending_block_number_idx ON public.ckb_transactions_pending USING btree (block_number);
4189+
4190+
41704191
--
41714192
-- Name: ckb_transactions_pending_block_timestamp_id_idx; Type: INDEX; Schema: public; Owner: -
41724193
--
@@ -4195,6 +4216,13 @@ CREATE INDEX ckb_transactions_pending_tx_hash_idx ON public.ckb_transactions_pen
41954216
CREATE INDEX ckb_transactions_proposed_block_id_block_timestamp_idx ON public.ckb_transactions_proposed USING btree (block_id, block_timestamp);
41964217

41974218

4219+
--
4220+
-- Name: ckb_transactions_proposed_block_number_idx; Type: INDEX; Schema: public; Owner: -
4221+
--
4222+
4223+
CREATE INDEX ckb_transactions_proposed_block_number_idx ON public.ckb_transactions_proposed USING btree (block_number);
4224+
4225+
41984226
--
41994227
-- Name: ckb_transactions_proposed_block_timestamp_id_idx; Type: INDEX; Schema: public; Owner: -
42004228
--
@@ -4223,6 +4251,13 @@ CREATE INDEX ckb_transactions_proposed_tx_hash_idx ON public.ckb_transactions_pr
42234251
CREATE INDEX ckb_transactions_rejected_block_id_block_timestamp_idx ON public.ckb_transactions_rejected USING btree (block_id, block_timestamp);
42244252

42254253

4254+
--
4255+
-- Name: ckb_transactions_rejected_block_number_idx; Type: INDEX; Schema: public; Owner: -
4256+
--
4257+
4258+
CREATE INDEX ckb_transactions_rejected_block_number_idx ON public.ckb_transactions_rejected USING btree (block_number);
4259+
4260+
42264261
--
42274262
-- Name: ckb_transactions_rejected_block_timestamp_id_idx; Type: INDEX; Schema: public; Owner: -
42284263
--
@@ -5329,6 +5364,13 @@ ALTER INDEX public.index_cell_outputs_on_type_script_id ATTACH PARTITION public.
53295364
ALTER INDEX public.idx_ckb_txs_for_blocks ATTACH PARTITION public.ckb_transactions_committed_block_id_block_timestamp_idx;
53305365

53315366

5367+
--
5368+
-- Name: ckb_transactions_committed_block_number_idx; Type: INDEX ATTACH; Schema: public; Owner: -
5369+
--
5370+
5371+
ALTER INDEX public.index_ckb_transactions_on_block_number ATTACH PARTITION public.ckb_transactions_committed_block_number_idx;
5372+
5373+
53325374
--
53335375
-- Name: ckb_transactions_committed_block_timestamp_id_idx; Type: INDEX ATTACH; Schema: public; Owner: -
53345376
--
@@ -5371,6 +5413,13 @@ ALTER INDEX public.ckb_tx_uni_tx_hash ATTACH PARTITION public.ckb_transactions_c
53715413
ALTER INDEX public.idx_ckb_txs_for_blocks ATTACH PARTITION public.ckb_transactions_pending_block_id_block_timestamp_idx;
53725414

53735415

5416+
--
5417+
-- Name: ckb_transactions_pending_block_number_idx; Type: INDEX ATTACH; Schema: public; Owner: -
5418+
--
5419+
5420+
ALTER INDEX public.index_ckb_transactions_on_block_number ATTACH PARTITION public.ckb_transactions_pending_block_number_idx;
5421+
5422+
53745423
--
53755424
-- Name: ckb_transactions_pending_block_timestamp_id_idx; Type: INDEX ATTACH; Schema: public; Owner: -
53765425
--
@@ -5413,6 +5462,13 @@ ALTER INDEX public.ckb_tx_uni_tx_hash ATTACH PARTITION public.ckb_transactions_p
54135462
ALTER INDEX public.idx_ckb_txs_for_blocks ATTACH PARTITION public.ckb_transactions_proposed_block_id_block_timestamp_idx;
54145463

54155464

5465+
--
5466+
-- Name: ckb_transactions_proposed_block_number_idx; Type: INDEX ATTACH; Schema: public; Owner: -
5467+
--
5468+
5469+
ALTER INDEX public.index_ckb_transactions_on_block_number ATTACH PARTITION public.ckb_transactions_proposed_block_number_idx;
5470+
5471+
54165472
--
54175473
-- Name: ckb_transactions_proposed_block_timestamp_id_idx; Type: INDEX ATTACH; Schema: public; Owner: -
54185474
--
@@ -5455,6 +5511,13 @@ ALTER INDEX public.ckb_tx_uni_tx_hash ATTACH PARTITION public.ckb_transactions_p
54555511
ALTER INDEX public.idx_ckb_txs_for_blocks ATTACH PARTITION public.ckb_transactions_rejected_block_id_block_timestamp_idx;
54565512

54575513

5514+
--
5515+
-- Name: ckb_transactions_rejected_block_number_idx; Type: INDEX ATTACH; Schema: public; Owner: -
5516+
--
5517+
5518+
ALTER INDEX public.index_ckb_transactions_on_block_number ATTACH PARTITION public.ckb_transactions_rejected_block_number_idx;
5519+
5520+
54585521
--
54595522
-- Name: ckb_transactions_rejected_block_timestamp_id_idx; Type: INDEX ATTACH; Schema: public; Owner: -
54605523
--
@@ -5876,6 +5939,7 @@ INSERT INTO "schema_migrations" (version) VALUES
58765939
('20250715034316'),
58775940
('20250715035736'),
58785941
('20250715043211'),
5879-
('20250826022054');
5942+
('20250826022054'),
5943+
('20250827065749');
58805944

58815945

0 commit comments

Comments
 (0)