Commit 0028de71 authored by Corinna Wiesner's avatar Corinna Wiesner

Introduce db table to store users statistics

The users statistics will be stored in the database to improve
performance.
parent 3f205500
# frozen_string_literal: true
class UsersStatistics < ApplicationRecord
STATISTICS_NAMES = [
:without_groups_and_projects,
:with_highest_role_guest,
:with_highest_role_reporter,
:with_highest_role_developer,
:with_highest_role_maintainer,
:with_highest_role_owner,
:bots,
:blocked
].freeze
end
---
title: Introduce db table to store users statistics
merge_request: 26261
author:
type: added
# frozen_string_literal: true
class CreateUsersStatistics < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
create_table :users_statistics do |t|
t.timestamps_with_timezone null: false
t.integer :without_groups_and_projects, null: false, default: 0
t.integer :with_highest_role_guest, null: false, default: 0
t.integer :with_highest_role_reporter, null: false, default: 0
t.integer :with_highest_role_developer, null: false, default: 0
t.integer :with_highest_role_maintainer, null: false, default: 0
t.integer :with_highest_role_owner, null: false, default: 0
t.integer :bots, null: false, default: 0
t.integer :blocked, null: false, default: 0
end
end
end
......@@ -4420,6 +4420,19 @@ ActiveRecord::Schema.define(version: 2020_03_09_105539) do
t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true
end
create_table "users_statistics", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "without_groups_and_projects", default: 0, null: false
t.integer "with_highest_role_guest", default: 0, null: false
t.integer "with_highest_role_reporter", default: 0, null: false
t.integer "with_highest_role_developer", default: 0, null: false
t.integer "with_highest_role_maintainer", default: 0, null: false
t.integer "with_highest_role_owner", default: 0, null: false
t.integer "bots", default: 0, null: false
t.integer "blocked", default: 0, null: false
end
create_table "vulnerabilities", force: :cascade do |t|
t.bigint "milestone_id"
t.bigint "epic_id"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment