diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20181205171941_create_project_daily_statistics.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 8 |
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 86cb896f9a6..a7a83475679 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1588,6 +1588,13 @@ ActiveRecord::Schema.define(version: 20190220150130) 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 @@ -2471,6 +2478,7 @@ ActiveRecord::Schema.define(version: 20190220150130) 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 |