diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /db/migrate/20200430174637_create_group_deploy_keys.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'db/migrate/20200430174637_create_group_deploy_keys.rb')
-rw-r--r-- | db/migrate/20200430174637_create_group_deploy_keys.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/db/migrate/20200430174637_create_group_deploy_keys.rb b/db/migrate/20200430174637_create_group_deploy_keys.rb new file mode 100644 index 00000000000..283c8769a80 --- /dev/null +++ b/db/migrate/20200430174637_create_group_deploy_keys.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class CreateGroupDeployKeys < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:group_deploy_keys) + with_lock_retries do + create_table :group_deploy_keys do |t| + t.references :user, foreign_key: { on_delete: :restrict }, index: true + t.timestamps_with_timezone + t.datetime_with_timezone :last_used_at + t.datetime_with_timezone :expires_at + t.text :key, null: false, unique: true + t.text :title + t.text :fingerprint, null: false, unique: true + t.binary :fingerprint_sha256 + + t.index :fingerprint, unique: true + t.index :fingerprint_sha256 + end + end + end + + add_text_limit(:group_deploy_keys, :key, 4096) + add_text_limit(:group_deploy_keys, :title, 255) + add_text_limit(:group_deploy_keys, :fingerprint, 255) + end + + def down + # rubocop:disable Migration/DropTable + drop_table :group_deploy_keys + # rubocop:enable Migration/DropTable + end +end |