Skip to content

Commit

Permalink
feat: add block statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 2, 2019
1 parent bd2b38f commit 23d38f2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/models/block_statistic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class BlockStatistic < ApplicationRecord
end

# == Schema Information
#
# Table name: block_statistics
#
# id :bigint not null, primary key
# difficulty :string
# hash_rate :string
# live_cell_count :string default("0")
# dead_cell_count :string default("0")
# block_number :string
# created_at :datetime not null
# updated_at :datetime not null
#
13 changes: 13 additions & 0 deletions db/migrate/20191201023327_create_block_statistics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateBlockStatistics < ActiveRecord::Migration[6.0]
def change
create_table :block_statistics do |t|
t.string :difficulty
t.string :hash_rate
t.string :live_cell_count, default: "0"
t.string :dead_cell_count, default: "0"
t.string :block_number

t.timestamps
end
end
end
12 changes: 11 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_11_27_045149) do
ActiveRecord::Schema.define(version: 2019_12_01_023327) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -40,6 +40,16 @@
t.index ["lock_hash"], name: "index_addresses_on_lock_hash", unique: true
end

create_table "block_statistics", force: :cascade do |t|
t.string "difficulty"
t.string "hash_rate"
t.string "live_cell_count", default: "0"
t.string "dead_cell_count", default: "0"
t.string "block_number"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "blocks", force: :cascade do |t|
t.binary "block_hash"
t.decimal "number", precision: 30
Expand Down

0 comments on commit 23d38f2

Please sign in to comment.