diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) | |
download | gitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb')
-rw-r--r-- | db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb b/db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb new file mode 100644 index 00000000000..fd01437d045 --- /dev/null +++ b/db/migrate/20220301175426_create_project_build_artifacts_size_refresh.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateProjectBuildArtifactsSizeRefresh < Gitlab::Database::Migration[1.0] + enable_lock_retries! + + CREATED_STATE = 1 + + def change + create_table :project_build_artifacts_size_refreshes do |t| + t.references :project, index: { unique: true }, foreign_key: { on_delete: :cascade }, null: false + t.bigint :last_job_artifact_id, null: true + t.integer :state, null: false, default: CREATED_STATE, limit: 1 + t.datetime_with_timezone :refresh_started_at, null: true + t.timestamps_with_timezone null: false + + # We will use this index for 2 purposes: + # - for finding rows with state = :waiting + # - for finding rows with state = :running and updated_at < x.days.ago + # which we can use to find jobs that were not able to complete and considered + # stale so we can retry + t.index [:state, :updated_at], name: 'idx_build_artifacts_size_refreshes_state_updated_at' + end + end +end |