Skip to content

Commit 655fe4c

Browse files
committed
remove remove_dao_tx_count_of_address and remove_dao_tx_count_of_address
1 parent 12b8a72 commit 655fe4c

17 files changed

+26
-158
lines changed

app/models/address.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def unmade_dao_interests
222222
# average_deposit_time :bigint
223223
# unclaimed_compensation :decimal(30, )
224224
# is_depositor :boolean default(FALSE)
225-
# dao_transactions_count :bigint default(0)
226225
# lock_script_id :bigint
227226
# balance_occupied :decimal(30, ) default(0)
228227
# last_updated_block_number :bigint

app/models/address_block_snapshot.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/workers/calculate_address_info_worker.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ def perform()
2929
balance_occupied: balance_occupied,
3030
ckb_transactions_count: AccountBook.where(address_id: addr.id).count,
3131
live_cells_count: addr.cell_outputs.live.count,
32-
dao_transactions_count: addr.ckb_dao_transactions.count,
33-
created_at: addr.created_at,
3432
updated_at: Time.current
3533
}
3634

app/workers/update_address_info_worker.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ def perform(block_number)
1515
balance_occupied: balance_occupied,
1616
ckb_transactions_count: AccountBook.where(address_id: addr.id).count,
1717
live_cells_count: addr.cell_outputs.live.count,
18-
dao_transactions_count: addr.ckb_dao_transactions.count,
19-
created_at: addr.created_at,
2018
updated_at: Time.current
2119
}
2220
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class RemoveDaoTxCountOfAddress < ActiveRecord::Migration[7.0]
2+
def change
3+
remove_columns :addresses, :dao_transactions_count, type: :bigint
4+
end
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class RemoveAddressBlockSnapshot < ActiveRecord::Migration[7.0]
2+
def change
3+
drop_table :address_block_snapshots, if_exists: true
4+
end
5+
end

db/structure.sql

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
\restrict V8s7yzWY55LtWT8dJxqVvS1WjoR0TM2QsXaaB8DbB1Z9VB52I6EqVzTa1wJnm75
2+
3+
-- Dumped from database version 16.10
4+
-- Dumped by pg_dump version 16.10
5+
16
SET statement_timeout = 0;
27
SET lock_timeout = 0;
38
SET idle_in_transaction_session_timeout = 0;
@@ -60,38 +65,6 @@ CREATE SEQUENCE public.account_books_id_seq
6065
ALTER SEQUENCE public.account_books_id_seq OWNED BY public.account_books.id;
6166

6267

63-
--
64-
-- Name: address_block_snapshots; Type: TABLE; Schema: public; Owner: -
65-
--
66-
67-
CREATE TABLE public.address_block_snapshots (
68-
id bigint NOT NULL,
69-
address_id bigint,
70-
block_id bigint,
71-
block_number bigint,
72-
final_state jsonb
73-
);
74-
75-
76-
--
77-
-- Name: address_block_snapshots_id_seq; Type: SEQUENCE; Schema: public; Owner: -
78-
--
79-
80-
CREATE SEQUENCE public.address_block_snapshots_id_seq
81-
START WITH 1
82-
INCREMENT BY 1
83-
NO MINVALUE
84-
NO MAXVALUE
85-
CACHE 1;
86-
87-
88-
--
89-
-- Name: address_block_snapshots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
90-
--
91-
92-
ALTER SEQUENCE public.address_block_snapshots_id_seq OWNED BY public.address_block_snapshots.id;
93-
94-
9568
--
9669
-- Name: address_udt_transactions; Type: TABLE; Schema: public; Owner: -
9770
--
@@ -123,7 +96,6 @@ CREATE TABLE public.addresses (
12396
average_deposit_time bigint,
12497
unclaimed_compensation numeric(30,0),
12598
is_depositor boolean DEFAULT false,
126-
dao_transactions_count bigint DEFAULT 0.0,
12799
lock_script_id bigint,
128100
balance_occupied numeric(30,0) DEFAULT 0.0,
129101
last_updated_block_number bigint
@@ -2771,13 +2743,6 @@ ALTER TABLE ONLY public.ckb_transactions ATTACH PARTITION public.ckb_transaction
27712743
ALTER TABLE ONLY public.account_books ALTER COLUMN id SET DEFAULT nextval('public.account_books_id_seq'::regclass);
27722744

27732745

2774-
--
2775-
-- Name: address_block_snapshots id; Type: DEFAULT; Schema: public; Owner: -
2776-
--
2777-
2778-
ALTER TABLE ONLY public.address_block_snapshots ALTER COLUMN id SET DEFAULT nextval('public.address_block_snapshots_id_seq'::regclass);
2779-
2780-
27812746
--
27822747
-- Name: addresses id; Type: DEFAULT; Schema: public; Owner: -
27832748
--
@@ -3199,14 +3164,6 @@ ALTER TABLE ONLY public.account_books
31993164
ADD CONSTRAINT account_books_pkey PRIMARY KEY (id);
32003165

32013166

3202-
--
3203-
-- Name: address_block_snapshots address_block_snapshots_pkey; Type: CONSTRAINT; Schema: public; Owner: -
3204-
--
3205-
3206-
ALTER TABLE ONLY public.address_block_snapshots
3207-
ADD CONSTRAINT address_block_snapshots_pkey PRIMARY KEY (id);
3208-
3209-
32103167
--
32113168
-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
32123169
--
@@ -4362,27 +4319,6 @@ CREATE INDEX index_account_books_on_block_number_and_tx_index ON public.account_
43624319
CREATE INDEX index_account_books_on_ckb_transaction_id ON public.account_books USING btree (ckb_transaction_id);
43634320

43644321

4365-
--
4366-
-- Name: index_address_block_snapshots_on_address_id; Type: INDEX; Schema: public; Owner: -
4367-
--
4368-
4369-
CREATE INDEX index_address_block_snapshots_on_address_id ON public.address_block_snapshots USING btree (address_id);
4370-
4371-
4372-
--
4373-
-- Name: index_address_block_snapshots_on_block_id; Type: INDEX; Schema: public; Owner: -
4374-
--
4375-
4376-
CREATE INDEX index_address_block_snapshots_on_block_id ON public.address_block_snapshots USING btree (block_id);
4377-
4378-
4379-
--
4380-
-- Name: index_address_block_snapshots_on_block_id_and_address_id; Type: INDEX; Schema: public; Owner: -
4381-
--
4382-
4383-
CREATE UNIQUE INDEX index_address_block_snapshots_on_block_id_and_address_id ON public.address_block_snapshots USING btree (block_id, address_id);
4384-
4385-
43864322
--
43874323
-- Name: index_address_udt_transactions_on_ckb_transaction_id; Type: INDEX; Schema: public; Owner: -
43884324
--
@@ -5627,6 +5563,8 @@ ALTER TABLE ONLY public.udt_transactions
56275563
-- PostgreSQL database dump complete
56285564
--
56295565

5566+
\unrestrict V8s7yzWY55LtWT8dJxqVvS1WjoR0TM2QsXaaB8DbB1Z9VB52I6EqVzTa1wJnm75
5567+
56305568
SET search_path TO "$user", public;
56315569

56325570
INSERT INTO "schema_migrations" (version) VALUES
@@ -6005,6 +5943,8 @@ INSERT INTO "schema_migrations" (version) VALUES
60055943
('20250827065749'),
60065944
('20250930015526'),
60075945
('20251011011714'),
6008-
('20251013082609');
5946+
('20251013082609'),
5947+
('20251027053353'),
5948+
('20251027054232');
60095949

60105950

lib/tasks/migration/check_address_info.rake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace :migration do
99
address.last_updated_block_number = local_tip_block.number
1010
address.live_cells_count = address.cell_outputs.live.where("block_timestamp <= ?", local_tip_block.timestamp).count
1111
address.ckb_transactions_count = AccountBook.where(address_id: address.id).where("block_number <= ?", local_tip_block.number).count
12-
address.dao_transactions_count = DaoEvent.processed.where(address_id: address.id).where("block_timestamp <= ?", local_tip_block.timestamp).distinct.count(:ckb_transaction_id)
1312
address.cal_balance!
1413
address.save!
1514
end

lib/tasks/migration/fill_dao_transactions_count_to_address.rake

Lines changed: 0 additions & 21 deletions
This file was deleted.

lib/tasks/migration/fix_address_tx_count.rake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace :migration do
88
local_tip_block = Block.recent.first
99
address.update(
1010
ckb_transactions_count: AccountBook.where(address_id: address.id).where("block_number <= ?", local_tip_block.number).count,
11-
dao_transactions_count: DaoEvent.processed.where(address_id: address.id).where("block_timestamp <= ?", local_tip_block.timestamp).distinct.count(:ckb_transaction_id),
1211
last_updated_block_number: local_tip_block.number,
1312
)
1413
AddressBlockSnapshot.where(address_id: address.id).delete_all

0 commit comments

Comments
 (0)