Skip to content

Commit

Permalink
feat: add daily_statistic model
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Nov 29, 2019
1 parent 5360c91 commit c42ef94
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class DailyStatistic < ApplicationRecord
end

# == Schema Information
#
# Table name: daily_statistics
#
# id :bigint not null, primary key
# transactions_count :integer default(0)
# addresses_count :integer default(0)
# total_dao_deposit :decimal(30, ) default(0)
# block_timestamp :decimal(30, )
# created_at_unixtimestamp :integer
# created_at :datetime not null
# updated_at :datetime not null
#
13 changes: 13 additions & 0 deletions db/migrate/20191127045149_create_daily_statistics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateDailyStatistics < ActiveRecord::Migration[6.0]
def change
create_table :daily_statistics do |t|
t.integer :transactions_count, default: 0
t.integer :addresses_count, default: 0
t.decimal :total_dao_deposit, precision: 30, default: 0
t.decimal :block_timestamp, precision: 30
t.integer :created_at_unixtimestamp

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_26_225038) do
ActiveRecord::Schema.define(version: 2019_11_27_045149) do

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

create_table "daily_statistics", force: :cascade do |t|
t.integer "transactions_count", default: 0
t.integer "addresses_count", default: 0
t.decimal "total_dao_deposit", precision: 30, default: "0"
t.decimal "block_timestamp", precision: 30
t.integer "created_at_unixtimestamp"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end

create_table "dao_contracts", force: :cascade do |t|
t.decimal "total_deposit", precision: 30, default: "0"
t.decimal "interest_granted", precision: 30, default: "0"
Expand Down
7 changes: 7 additions & 0 deletions test/models/daily_statistic_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class DailyStatisticTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit c42ef94

Please sign in to comment.