diff --git a/app/models/daily_statistic.rb b/app/models/daily_statistic.rb new file mode 100644 index 000000000..702f89110 --- /dev/null +++ b/app/models/daily_statistic.rb @@ -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 +# diff --git a/db/migrate/20191127045149_create_daily_statistics.rb b/db/migrate/20191127045149_create_daily_statistics.rb new file mode 100644 index 000000000..fcc99cecb --- /dev/null +++ b/db/migrate/20191127045149_create_daily_statistics.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index a1f71fecb..4e136df8c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" @@ -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" diff --git a/test/models/daily_statistic_test.rb b/test/models/daily_statistic_test.rb new file mode 100644 index 000000000..7101e98c5 --- /dev/null +++ b/test/models/daily_statistic_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DailyStatisticTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end