From aee1474ea5aeeb55e69ab3b0691ab7355196bcd1 Mon Sep 17 00:00:00 2001
From: Alper Akgun <aakgun@gitlab.com>
Date: Mon, 22 Aug 2022 10:58:59 +0300
Subject: [PATCH] Remove other_role column from user_details

Changelog: removed
---
 ...20220822071909_remove_other_role_from_user_details.rb | 9 +++++++++
 db/schema_migrations/20220822071909                      | 1 +
 db/structure.sql                                         | 2 --
 .../controllers/ee/registrations/welcome_controller.rb   | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 db/post_migrate/20220822071909_remove_other_role_from_user_details.rb
 create mode 100644 db/schema_migrations/20220822071909

diff --git a/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb b/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb
new file mode 100644
index 0000000000000..a0177bf260581
--- /dev/null
+++ b/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveOtherRoleFromUserDetails < Gitlab::Database::Migration[2.0]
+  enable_lock_retries!
+
+  def change
+    remove_column :user_details, :other_role, :text
+  end
+end
diff --git a/db/schema_migrations/20220822071909 b/db/schema_migrations/20220822071909
new file mode 100644
index 0000000000000..fd8af68d1ee5d
--- /dev/null
+++ b/db/schema_migrations/20220822071909
@@ -0,0 +1 @@
+60a72830780190214d6c86fc2d07dc0fc138f6cc258689c1d106bb456b130047
\ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index b9bfe44117d88..22377d4e1191d 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -21853,7 +21853,6 @@ CREATE TABLE user_details (
     job_title character varying(200) DEFAULT ''::character varying NOT NULL,
     bio character varying(255) DEFAULT ''::character varying NOT NULL,
     webauthn_xid text,
-    other_role text,
     provisioned_by_group_id bigint,
     pronouns text,
     pronunciation text,
@@ -21862,7 +21861,6 @@ CREATE TABLE user_details (
     requires_credit_card_verification boolean DEFAULT false NOT NULL,
     CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)),
     CONSTRAINT check_a73b398c60 CHECK ((char_length(phone) <= 50)),
-    CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100)),
     CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50)),
     CONSTRAINT check_f932ed37db CHECK ((char_length(pronunciation) <= 255))
 );
diff --git a/ee/app/controllers/ee/registrations/welcome_controller.rb b/ee/app/controllers/ee/registrations/welcome_controller.rb
index bea36a3750fcd..3b569f14219c6 100644
--- a/ee/app/controllers/ee/registrations/welcome_controller.rb
+++ b/ee/app/controllers/ee/registrations/welcome_controller.rb
@@ -122,7 +122,7 @@ def path_for_signed_in_user(user)
         stored_url = stored_location_for(user)
         if ::Feature.enabled?(:about_your_company_registration_flow) &&
             stored_url&.include?(new_users_sign_up_company_path)
-          company_params = update_params.slice(:role, :other_role, :registration_objective)
+          company_params = update_params.slice(:role, :registration_objective)
                             .merge(params.permit(:jobs_to_be_done_other))
           redirect_uri = ::Gitlab::Utils.add_url_parameters(stored_url, company_params)
           store_location_for(:user, redirect_uri)
-- 
GitLab