-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2066 from nervosnetwork/testnet
Deploy to mainnet
- Loading branch information
Showing
19 changed files
with
1,104 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
db/migrate/20240704092919_add_holder_count_to_daily_statistic.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddHolderCountToDailyStatistic < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :daily_statistics, :holder_count, :integer | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
db/migrate/20240709131020_rename_cell_outputs_to_cell_outputs_old.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class RenameCellOutputsToCellOutputsOld < ActiveRecord::Migration[7.0] | ||
def up | ||
rename_table :cell_outputs, :cell_outputs_old | ||
end | ||
|
||
def down | ||
rename_table :cell_outputs_old, :cell_outputs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class CreateCellOutputs < ActiveRecord::Migration[7.0] | ||
def up | ||
execute <<-SQL | ||
CREATE TABLE cell_outputs ( | ||
id bigserial NOT NULL, | ||
capacity numeric(64,2), | ||
ckb_transaction_id bigint, | ||
created_at timestamp without time zone NOT NULL, | ||
updated_at timestamp without time zone NOT NULL, | ||
status smallint DEFAULT 0, | ||
address_id numeric(30,0), | ||
block_id numeric(30,0), | ||
tx_hash bytea, | ||
cell_index integer, | ||
consumed_by_id numeric(30,0), | ||
cell_type integer DEFAULT 0, | ||
data_size integer, | ||
occupied_capacity numeric(30,0), | ||
block_timestamp numeric(30,0), | ||
consumed_block_timestamp numeric(30,0), | ||
type_hash character varying, | ||
udt_amount numeric(40,0), | ||
dao character varying, | ||
lock_script_id bigint, | ||
type_script_id bigint, | ||
data_hash bytea, | ||
primary key (id, status) | ||
) PARTITION BY LIST (status); | ||
CREATE TABLE cell_outputs_live PARTITION OF cell_outputs | ||
FOR VALUES IN (0); | ||
CREATE TABLE cell_outputs_dead PARTITION OF cell_outputs | ||
FOR VALUES IN (1); | ||
CREATE TABLE cell_outputs_pending PARTITION OF cell_outputs | ||
FOR VALUES IN (2); | ||
CREATE TABLE cell_outputs_rejected PARTITION OF cell_outputs | ||
FOR VALUES IN (3); | ||
SQL | ||
end | ||
|
||
def down | ||
drop_table :cell_outputs | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
db/migrate/20240709131713_import_cell_outputs_old_to_cell_outputs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class ImportCellOutputsOldToCellOutputs < ActiveRecord::Migration[7.0] | ||
def up | ||
execute <<~SQL | ||
SET statement_timeout = 0; | ||
INSERT INTO cell_outputs (id, capacity, ckb_transaction_id, status, address_id, block_id, tx_hash, cell_index, consumed_by_id, cell_type, data_size, occupied_capacity, block_timestamp, consumed_block_timestamp, type_hash, udt_amount, dao, lock_script_id, type_script_id, data_hash, created_at, updated_at) | ||
SELECT id, capacity, ckb_transaction_id, status, address_id, block_id, tx_hash, cell_index, consumed_by_id, cell_type, data_size, occupied_capacity, block_timestamp, consumed_block_timestamp, type_hash, udt_amount, dao, lock_script_id, type_script_id, data_hash, created_at, updated_at FROM cell_outputs_old; | ||
SELECT setval('cell_outputs_id_seq', (SELECT max(id) FROM cell_outputs)); | ||
SQL | ||
end | ||
|
||
def down | ||
execute <<~SQL | ||
TRUNCATE TABLE cell_outputs; | ||
SQL | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class AddIndexToCellOutputs < ActiveRecord::Migration[7.0] | ||
def change | ||
add_index :cell_outputs, :address_id | ||
add_index :cell_outputs, :block_id | ||
add_index :cell_outputs, :consumed_by_id | ||
add_index :cell_outputs, :lock_script_id | ||
add_index :cell_outputs, :type_script_id | ||
add_index :cell_outputs, %i[ckb_transaction_id cell_index status], unique: true, name: "index_cell_outputs_on_tx_id_and_cell_index_and_status" | ||
add_index :cell_outputs, %i[tx_hash cell_index status], unique: true, name: "index_cell_outputs_on_tx_hash_and_cell_index_and_status" | ||
add_index :cell_outputs, :block_timestamp | ||
add_index :cell_outputs, :consumed_block_timestamp | ||
end | ||
end |
Oops, something went wrong.