Commit 2eaa1477 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'create_users_statistics' into 'master'

Introduce database table to store users statistics

See merge request gitlab-org/gitlab!26261
parents c555cde9 0028de71
# 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
...@@ -4421,6 +4421,19 @@ ActiveRecord::Schema.define(version: 2020_03_06_170531) do ...@@ -4421,6 +4421,19 @@ ActiveRecord::Schema.define(version: 2020_03_06_170531) do
t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true
end 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| create_table "vulnerabilities", force: :cascade do |t|
t.bigint "milestone_id" t.bigint "milestone_id"
t.bigint "epic_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