Skip to content

Commit 263a8d9

Browse files
committed
remove remove_dao_tx_count_of_address and remove_dao_tx_count_of_address
1 parent 12b8a72 commit 263a8d9

17 files changed

+19
-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: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -60,38 +60,6 @@ CREATE SEQUENCE public.account_books_id_seq
6060
ALTER SEQUENCE public.account_books_id_seq OWNED BY public.account_books.id;
6161

6262

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-
9563
--
9664
-- Name: address_udt_transactions; Type: TABLE; Schema: public; Owner: -
9765
--
@@ -123,7 +91,6 @@ CREATE TABLE public.addresses (
12391
average_deposit_time bigint,
12492
unclaimed_compensation numeric(30,0),
12593
is_depositor boolean DEFAULT false,
126-
dao_transactions_count bigint DEFAULT 0.0,
12794
lock_script_id bigint,
12895
balance_occupied numeric(30,0) DEFAULT 0.0,
12996
last_updated_block_number bigint
@@ -2771,13 +2738,6 @@ ALTER TABLE ONLY public.ckb_transactions ATTACH PARTITION public.ckb_transaction
27712738
ALTER TABLE ONLY public.account_books ALTER COLUMN id SET DEFAULT nextval('public.account_books_id_seq'::regclass);
27722739

27732740

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-
27812741
--
27822742
-- Name: addresses id; Type: DEFAULT; Schema: public; Owner: -
27832743
--
@@ -3199,14 +3159,6 @@ ALTER TABLE ONLY public.account_books
31993159
ADD CONSTRAINT account_books_pkey PRIMARY KEY (id);
32003160

32013161

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-
32103162
--
32113163
-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
32123164
--
@@ -4362,27 +4314,6 @@ CREATE INDEX index_account_books_on_block_number_and_tx_index ON public.account_
43624314
CREATE INDEX index_account_books_on_ckb_transaction_id ON public.account_books USING btree (ckb_transaction_id);
43634315

43644316

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-
43864317
--
43874318
-- Name: index_address_udt_transactions_on_ckb_transaction_id; Type: INDEX; Schema: public; Owner: -
43884319
--
@@ -6005,6 +5936,8 @@ INSERT INTO "schema_migrations" (version) VALUES
60055936
('20250827065749'),
60065937
('20250930015526'),
60075938
('20251011011714'),
6008-
('20251013082609');
5939+
('20251013082609'),
5940+
('20251027053353'),
5941+
('20251027054232');
60095942

60105943

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)