diff options
Diffstat (limited to 'db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb')
-rw-r--r-- | db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb b/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb new file mode 100644 index 00000000000..5fc8970b8f9 --- /dev/null +++ b/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddNotNullConstraintToClusterTokenName < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + # This will add the `NOT NULL` constraint WITHOUT validating it + add_not_null_constraint :cluster_agent_tokens, :name, validate: false + end + + def down + remove_not_null_constraint :cluster_agent_tokens, :name + end +end |