summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-12-13 20:26:56 +0100
committerJacopo <beschi.jacopo@gmail.com>2019-02-27 11:52:35 +0100
commit5ae9a44aa17c8929627cc450f936cd960c143e25 (patch)
tree6a14d388f5687979a683d443868b4297ebc6838c /db
parent6fa88ed77e1693cda845efe49bf2c9a77aed2e4f (diff)
downloadgitlab-ce-5ae9a44aa17c8929627cc450f936cd960c143e25.tar.gz
Add project http fetch statistics API
The API get projects/:id/traffic/fetches allows user with write access to the repository to get the number of clones for the last 30 days.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20181205171941_create_project_daily_statistics.rb18
-rw-r--r--db/schema.rb8
2 files changed, 26 insertions, 0 deletions
diff --git a/db/migrate/20181205171941_create_project_daily_statistics.rb b/db/migrate/20181205171941_create_project_daily_statistics.rb
new file mode 100644
index 00000000000..c9e2a1e1aa7
--- /dev/null
+++ b/db/migrate/20181205171941_create_project_daily_statistics.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateProjectDailyStatistics < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :project_daily_statistics, id: :bigserial do |t|
+ t.integer :project_id, null: false
+ t.integer :fetch_count, null: false
+ t.date :date
+
+ t.index [:project_id, :date], unique: true, order: { date: :desc }
+ t.foreign_key :projects, on_delete: :cascade
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 1651a24f412..3a2bab1c57e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1578,6 +1578,13 @@ ActiveRecord::Schema.define(version: 20190204115450) do
t.index ["project_id", "key"], name: "index_project_custom_attributes_on_project_id_and_key", unique: true, using: :btree
end
+ create_table "project_daily_statistics", id: :bigserial, force: :cascade do |t|
+ t.integer "project_id", null: false
+ t.integer "fetch_count", null: false
+ t.date "date"
+ t.index ["project_id", "date"], name: "index_project_daily_statistics_on_project_id_and_date", unique: true, order: { date: :desc }, using: :btree
+ end
+
create_table "project_deploy_tokens", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "deploy_token_id", null: false
@@ -2461,6 +2468,7 @@ ActiveRecord::Schema.define(version: 20190204115450) do
add_foreign_key "project_auto_devops", "projects", on_delete: :cascade
add_foreign_key "project_ci_cd_settings", "projects", name: "fk_24c15d2f2e", on_delete: :cascade
add_foreign_key "project_custom_attributes", "projects", on_delete: :cascade
+ add_foreign_key "project_daily_statistics", "projects", on_delete: :cascade
add_foreign_key "project_deploy_tokens", "deploy_tokens", on_delete: :cascade
add_foreign_key "project_deploy_tokens", "projects", on_delete: :cascade
add_foreign_key "project_error_tracking_settings", "projects", on_delete: :cascade