diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /db/migrate/20200821194920_create_atlassian_identities.rb | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'db/migrate/20200821194920_create_atlassian_identities.rb')
-rw-r--r-- | db/migrate/20200821194920_create_atlassian_identities.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/db/migrate/20200821194920_create_atlassian_identities.rb b/db/migrate/20200821194920_create_atlassian_identities.rb new file mode 100644 index 00000000000..1aab9ed6381 --- /dev/null +++ b/db/migrate/20200821194920_create_atlassian_identities.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +class CreateAtlassianIdentities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:atlassian_identities) + with_lock_retries do + create_table :atlassian_identities, id: false do |t| + t.references :user, index: false, foreign_key: { on_delete: :cascade }, null: false, primary_key: true + t.timestamps_with_timezone + t.datetime_with_timezone :expires_at + t.text :extern_uid, null: false, index: { unique: true } + t.binary :encrypted_token + t.binary :encrypted_token_iv + t.binary :encrypted_refresh_token + t.binary :encrypted_refresh_token_iv + end + end + end + + add_text_limit :atlassian_identities, :extern_uid, 255 + + add_check_constraint :atlassian_identities, 'octet_length(encrypted_token) <= 2048', 'atlassian_identities_token_length_constraint' + add_check_constraint :atlassian_identities, 'octet_length(encrypted_token_iv) <= 12', 'atlassian_identities_token_iv_length_constraint' + add_check_constraint :atlassian_identities, 'octet_length(encrypted_refresh_token) <= 512', 'atlassian_identities_refresh_token_length_constraint' + add_check_constraint :atlassian_identities, 'octet_length(encrypted_refresh_token_iv) <= 12', 'atlassian_identities_refresh_token_iv_length_constraint' + end + + def down + with_lock_retries do + drop_table :atlassian_identities + end + end +end |