Skip to content

Commit

Permalink
feat: add live_cell_changes to block and ckb_transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 25, 2019
1 parent 93f437b commit 2f04c62
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions app/models/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def invalid!
# length :decimal(30, ) default(0)
# uncles_count :integer
# compact_target :decimal(20, )
# live_cell_changes :integer
#
# Indexes
#
Expand Down
29 changes: 15 additions & 14 deletions app/models/ckb_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,21 @@ def recover_dead_cell
#
# Table name: ckb_transactions
#
# id :bigint not null, primary key
# tx_hash :binary
# deps :jsonb
# block_id :bigint
# block_number :decimal(30, )
# block_timestamp :decimal(30, )
# transaction_fee :decimal(30, )
# version :integer
# created_at :datetime not null
# updated_at :datetime not null
# is_cellbase :boolean default(FALSE)
# header_deps :binary
# cell_deps :jsonb
# witnesses :jsonb
# id :bigint not null, primary key
# tx_hash :binary
# deps :jsonb
# block_id :bigint
# block_number :decimal(30, )
# block_timestamp :decimal(30, )
# transaction_fee :decimal(30, )
# version :integer
# created_at :datetime not null
# updated_at :datetime not null
# is_cellbase :boolean default(FALSE)
# witnesses :jsonb
# header_deps :binary
# cell_deps :jsonb
# live_cell_changes :integer
#
# Indexes
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddLiveCellChangesToBlockAndCkbTransaction < ActiveRecord::Migration[6.0]
def change
add_column :blocks, :live_cell_changes, :integer
add_column :ckb_transactions, :live_cell_changes, :integer
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_12_16_080206) do
ActiveRecord::Schema.define(version: 2019_12_25_110229) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -89,6 +89,7 @@
t.decimal "length", precision: 30, default: "0"
t.integer "uncles_count"
t.decimal "compact_target", precision: 20
t.integer "live_cell_changes"
t.index ["block_hash"], name: "index_blocks_on_block_hash", unique: true
t.index ["number"], name: "index_blocks_on_number"
t.index ["timestamp"], name: "index_blocks_on_timestamp"
Expand Down Expand Up @@ -147,6 +148,7 @@
t.jsonb "witnesses"
t.binary "header_deps"
t.jsonb "cell_deps"
t.integer "live_cell_changes"
t.index ["block_id", "block_timestamp"], name: "index_ckb_transactions_on_block_id_and_block_timestamp"
t.index ["is_cellbase"], name: "index_ckb_transactions_on_is_cellbase"
t.index ["tx_hash", "block_id"], name: "index_ckb_transactions_on_tx_hash_and_block_id", unique: true
Expand Down

0 comments on commit 2f04c62

Please sign in to comment.