Skip to content

Commit d1ce815

Browse files
authored
Merge pull request #2667 from nervosnetwork/testnet
Deploy to mainnet
2 parents 9a1cc3d + a303c55 commit d1ce815

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

app/models/bitcoin_vout.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def commitment
4040
# Indexes
4141
#
4242
# index_bitcoin_vouts_on_bitcoin_address_id (bitcoin_address_id)
43+
# index_bitcoin_vouts_on_cell_output_id (cell_output_id)
4344
# index_bitcoin_vouts_on_ckb_transaction_id (ckb_transaction_id)
4445
# index_bitcoin_vouts_on_consumed_by_id (consumed_by_id)
4546
# index_bitcoin_vouts_on_status (status)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddIndexToBitcoinVoutForCellOutputId < ActiveRecord::Migration[7.0]
2+
def change
3+
add_index :bitcoin_vouts, :cell_output_id
4+
end
5+
end

db/structure.sql

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ COMMENT ON COLUMN public.blocks.ckb_node_version IS 'ckb node version, e.g. 0.10
227227
--
228228

229229
CREATE MATERIALIZED VIEW public.average_block_time_by_hour AS
230-
SELECT (blocks."timestamp" / 3600000) AS hour,
231-
avg(blocks.block_time) AS avg_block_time_per_hour
230+
SELECT ("timestamp" / 3600000) AS hour,
231+
avg(block_time) AS avg_block_time_per_hour
232232
FROM public.blocks
233-
GROUP BY (blocks."timestamp" / 3600000)
233+
GROUP BY ("timestamp" / 3600000)
234234
WITH NO DATA;
235235

236236

@@ -2056,9 +2056,9 @@ ALTER SEQUENCE public.rgbpp_hourly_statistics_id_seq OWNED BY public.rgbpp_hourl
20562056
--
20572057

20582058
CREATE MATERIALIZED VIEW public.rolling_avg_block_time AS
2059-
SELECT (average_block_time_by_hour.hour * 3600) AS "timestamp",
2060-
avg(average_block_time_by_hour.avg_block_time_per_hour) OVER (ORDER BY average_block_time_by_hour.hour ROWS BETWEEN 24 PRECEDING AND CURRENT ROW) AS avg_block_time_daily,
2061-
avg(average_block_time_by_hour.avg_block_time_per_hour) OVER (ORDER BY average_block_time_by_hour.hour ROWS BETWEEN (7 * 24) PRECEDING AND CURRENT ROW) AS avg_block_time_weekly
2059+
SELECT (hour * 3600) AS "timestamp",
2060+
avg(avg_block_time_per_hour) OVER (ORDER BY hour ROWS BETWEEN 24 PRECEDING AND CURRENT ROW) AS avg_block_time_daily,
2061+
avg(avg_block_time_per_hour) OVER (ORDER BY hour ROWS BETWEEN (7 * 24) PRECEDING AND CURRENT ROW) AS avg_block_time_weekly
20622062
FROM public.average_block_time_by_hour
20632063
WITH NO DATA;
20642064

@@ -4419,6 +4419,13 @@ CREATE UNIQUE INDEX index_bitcoin_vins_on_ckb_transaction_id_and_cell_input_id O
44194419
CREATE INDEX index_bitcoin_vouts_on_bitcoin_address_id ON public.bitcoin_vouts USING btree (bitcoin_address_id);
44204420

44214421

4422+
--
4423+
-- Name: index_bitcoin_vouts_on_cell_output_id; Type: INDEX; Schema: public; Owner: -
4424+
--
4425+
4426+
CREATE INDEX index_bitcoin_vouts_on_cell_output_id ON public.bitcoin_vouts USING btree (cell_output_id);
4427+
4428+
44224429
--
44234430
-- Name: index_bitcoin_vouts_on_ckb_transaction_id; Type: INDEX; Schema: public; Owner: -
44244431
--
@@ -5868,6 +5875,7 @@ INSERT INTO "schema_migrations" (version) VALUES
58685875
('20250715025723'),
58695876
('20250715034316'),
58705877
('20250715035736'),
5871-
('20250715043211');
5878+
('20250715043211'),
5879+
('20250826022054');
58725880

58735881

0 commit comments

Comments
 (0)