Skip to content

Commit

Permalink
feat: add new columns
Browse files Browse the repository at this point in the history
nodes_distribution and nodes_count
  • Loading branch information
shaojunda committed May 6, 2020
1 parent aa3bf6e commit 9b69d89
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class DailyStatistic < ApplicationRecord
VALID_INDICATORS = %w(
transactions_count addresses_count total_dao_deposit live_cells_count dead_cells_count avg_hash_rate avg_difficulty uncle_rate
total_depositors_count address_balance_distribution total_tx_fee occupied_capacity daily_dao_deposit daily_dao_depositors_count
circulation_ratio daily_dao_withdraw average_block_time
circulation_ratio daily_dao_withdraw nodes_count
).freeze
end

Expand Down Expand Up @@ -45,4 +45,6 @@ class DailyStatistic < ApplicationRecord
# epoch_time_distribution :jsonb
# epoch_length_distribution :jsonb
# average_block_time :jsonb
# nodes_distribution :jsonb
# nodes_count :integer
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddNodesDistributionToDailyStatistics < ActiveRecord::Migration[6.0]
def change
add_column :daily_statistics, :nodes_distribution, :jsonb
add_column :daily_statistics, :nodes_count, :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: 2020_04_30_124336) do
ActiveRecord::Schema.define(version: 2020_05_06_043401) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -207,6 +207,8 @@
t.jsonb "epoch_time_distribution"
t.jsonb "epoch_length_distribution"
t.jsonb "average_block_time"
t.jsonb "nodes_distribution"
t.integer "nodes_count"
end

create_table "dao_contracts", force: :cascade do |t|
Expand Down

0 comments on commit 9b69d89

Please sign in to comment.