diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /db/migrate/20211201143042_create_lfs_object_states.rb | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'db/migrate/20211201143042_create_lfs_object_states.rb')
-rw-r--r-- | db/migrate/20211201143042_create_lfs_object_states.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20211201143042_create_lfs_object_states.rb b/db/migrate/20211201143042_create_lfs_object_states.rb new file mode 100644 index 00000000000..91accbcd438 --- /dev/null +++ b/db/migrate/20211201143042_create_lfs_object_states.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class CreateLfsObjectStates < Gitlab::Database::Migration[1.0] + VERIFICATION_STATE_INDEX_NAME = "index_lfs_object_states_on_verification_state" + PENDING_VERIFICATION_INDEX_NAME = "index_lfs_object_states_pending_verification" + FAILED_VERIFICATION_INDEX_NAME = "index_lfs_object_states_failed_verification" + NEEDS_VERIFICATION_INDEX_NAME = "index_lfs_object_states_needs_verification" + + disable_ddl_transaction! + + def up + create_table :lfs_object_states, id: false do |t| + t.datetime_with_timezone :verification_started_at + t.datetime_with_timezone :verification_retry_at + t.datetime_with_timezone :verified_at + t.references :lfs_object, primary_key: true, null: false, foreign_key: { on_delete: :cascade } + t.integer :verification_state, default: 0, limit: 2, null: false + t.integer :verification_retry_count, limit: 2 + t.binary :verification_checksum, using: 'verification_checksum::bytea' + t.text :verification_failure, limit: 255 + + t.index :verification_state, name: VERIFICATION_STATE_INDEX_NAME + t.index :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME + t.index :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME + t.index :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME + end + end + + def down + drop_table :lfs_object_states + end +end |