From a69d78b79d1bd14ed160176bfddcf72f017bb8b3 Mon Sep 17 00:00:00 2001 From: ayobi Date: Mon, 5 Feb 2024 17:57:04 -0500 Subject: [PATCH 1/5] added admin delete reason --- microsetta_private_api/admin/admin_impl.py | 8 ++-- .../api/microsetta_private_api.yaml | 5 +++ microsetta_private_api/api/tests/test_api.py | 15 +++++--- microsetta_private_api/db/patches/0122.sql | 3 +- .../repo/removal_queue_repo.py | 38 +++++++++++++++++-- .../repo/tests/test_removal_queue_repo.py | 16 ++++---- 6 files changed, 65 insertions(+), 20 deletions(-) diff --git a/microsetta_private_api/admin/admin_impl.py b/microsetta_private_api/admin/admin_impl.py index 44e25c08b..edbc58933 100644 --- a/microsetta_private_api/admin/admin_impl.py +++ b/microsetta_private_api/admin/admin_impl.py @@ -885,7 +885,8 @@ def ignore_removal_request(account_id, token_info): try: # remove the user from the queue, noting the admin who allowed it # and the time the action was performed. - rq_repo.update_queue(account_id, token_info['email'], 'ignored') + rq_repo.update_queue(account_id, token_info['email'], + 'ignored', None) t.commit() except RepoException as e: raise e @@ -893,7 +894,7 @@ def ignore_removal_request(account_id, token_info): return None, 204 -def allow_removal_request(account_id, token_info): +def allow_removal_request(account_id, token_info, delete_reason): validate_admin_access(token_info) with Transaction() as t: @@ -902,7 +903,8 @@ def allow_removal_request(account_id, token_info): try: # remove the user from the queue, noting the admin who allowed it # and the time the action was performed. - rq_repo.update_queue(account_id, token_info['email'], 'deleted') + rq_repo.update_queue(account_id, token_info['email'], + 'deleted', delete_reason) t.commit() except RepoException as e: raise e diff --git a/microsetta_private_api/api/microsetta_private_api.yaml b/microsetta_private_api/api/microsetta_private_api.yaml index fc95ede93..8e43b62e6 100644 --- a/microsetta_private_api/api/microsetta_private_api.yaml +++ b/microsetta_private_api/api/microsetta_private_api.yaml @@ -2353,6 +2353,11 @@ paths: - Admin parameters: - $ref: '#/components/parameters/account_id' + - name: delete_reason + in: query + required: true + schema: + type: string responses: '200': description: Updates queue, log before calling delete_account() diff --git a/microsetta_private_api/api/tests/test_api.py b/microsetta_private_api/api/tests/test_api.py index 1bfb4a8bf..fa56e4322 100644 --- a/microsetta_private_api/api/tests/test_api.py +++ b/microsetta_private_api/api/tests/test_api.py @@ -1419,9 +1419,11 @@ def test_request_account_removal(self): self.assertFalse(json.loads(response.data)['status']) # submit a request for this account to be removed. + delete_reason = "User requested account removal" response = self.client.put( f'/api/accounts/{dummy_acct_id}/removal_queue', - headers=self.dummy_auth) + headers=self.dummy_auth, + json={'delete_reason': delete_reason}) self.assertEqual(200, response.status_code) @@ -1434,8 +1436,9 @@ def test_request_account_removal(self): headers=self.dummy_auth) self.assertEqual(200, response.status_code) - - self.assertTrue(json.loads(response.data)['status']) + removal_info = json.loads(response.data) + self.assertTrue(removal_info['status']) + # self.assertEqual(removal_info['delete_reason'], delete_reason) # try to request a second time. Verify that an error is returned # instead. @@ -1485,7 +1488,8 @@ def test_request_account_removal(self): "Request Accepted") response = self.client.put( - f'/api/admin/account_removal/{dummy_acct_id}', + f'/api/admin/account_removal/{dummy_acct_id}' + f'?delete_reason={delete_reason}', headers=make_headers(FAKE_TOKEN_ADMIN)) self.assertEqual(204, response.status_code) @@ -1551,7 +1555,8 @@ def test_request_account_removal(self): # functionality; it deletes the id from the delete-queue and logs the # deletion in a separate 'log' table, before calling account_delete(). response = self.client.delete( - f'/api/admin/account_removal/{dummy_acct_id}', + f'/api/admin/account_removal/{dummy_acct_id}' + f'?delete_reason={delete_reason}', headers=make_headers(FAKE_TOKEN_ADMIN)) # confirm that the operation was a success. diff --git a/microsetta_private_api/db/patches/0122.sql b/microsetta_private_api/db/patches/0122.sql index ee2dde3e3..4c61076cb 100644 --- a/microsetta_private_api/db/patches/0122.sql +++ b/microsetta_private_api/db/patches/0122.sql @@ -17,5 +17,6 @@ CREATE TABLE ag.account_removal_log ( -- user makes multiple requests. disposition DISPOSITION_TYPE, requested_on timestamptz, - reviewed_on timestamptz default current_timestamp + reviewed_on timestamptz default current_timestamp, + delete_reason VARCHAR ); diff --git a/microsetta_private_api/repo/removal_queue_repo.py b/microsetta_private_api/repo/removal_queue_repo.py index 4b83a45d2..3a90122b7 100644 --- a/microsetta_private_api/repo/removal_queue_repo.py +++ b/microsetta_private_api/repo/removal_queue_repo.py @@ -1,5 +1,7 @@ from microsetta_private_api.repo.base_repo import BaseRepo from microsetta_private_api.exceptions import RepoException +from microsetta_private_api.model.removal_queue_requests \ + import RemovalQueueRequest class RemovalQueueRepo(BaseRepo): @@ -14,6 +16,31 @@ def _check_account_is_admin(self, admin_email): return False if count == 0 else True + def _row_to_removal(self, r): + return RemovalQueueRequest(r['id'], r['account_id'], r['email'], + r['first_name'], r['last_name'], + r['requested_on']) + + def get_all_account_removal_requests(self): + with self._transaction.dict_cursor() as cur: + cur.execute(""" + SELECT + ag.delete_account_queue.id, + ag.delete_account_queue.account_id, + ag.delete_account_queue.requested_on, + ag.account.first_name, + ag.account.last_name, + ag.account.email + FROM + ag.account + JOIN + ag.delete_account_queue ON ag.account.id + = ag.delete_account_queue.account_id + """) + rows = cur.fetchall() + + return [self._row_to_removal(r) for r in rows] + def check_request_remove_account(self, account_id): with self._transaction.cursor() as cur: cur.execute("SELECT count(id) FROM delete_account_queue WHERE " @@ -43,7 +70,8 @@ def cancel_request_remove_account(self, account_id): cur.execute("DELETE FROM delete_account_queue WHERE account_id =" " %s", (account_id,)) - def update_queue(self, account_id, admin_email, disposition): + def update_queue(self, account_id, admin_email, + disposition, delete_reason): if not self.check_request_remove_account(account_id): raise RepoException("Account is not in removal queue") @@ -69,9 +97,11 @@ def update_queue(self, account_id, admin_email, disposition): # add an entry to the log detailing who reviewed the account # and when. cur.execute("INSERT INTO account_removal_log (account_id, " - "admin_id, disposition, requested_on) VALUES (%s," - " %s, %s, %s)", (account_id, admin_id, disposition, - requested_on)) + "admin_id, disposition, requested_on, delete_reason) " + "VALUES (%s, %s, %s, %s, %s)", (account_id, + admin_id, disposition, + requested_on, + delete_reason)) # delete the entry from queue. Note that reviewed entries are # deleted from the queue whether or not they were approved diff --git a/microsetta_private_api/repo/tests/test_removal_queue_repo.py b/microsetta_private_api/repo/tests/test_removal_queue_repo.py index b6df7ea34..8409603ec 100644 --- a/microsetta_private_api/repo/tests/test_removal_queue_repo.py +++ b/microsetta_private_api/repo/tests/test_removal_queue_repo.py @@ -194,7 +194,8 @@ def test_update_queue_success(self): # update_queue should migrate the relevant information to the # ag.account_removal_log table and delete the entry from the # queue table. - rqr.update_queue(self.acc.id, self.adm.email, 'deleted') + rqr.update_queue(self.acc.id, self.adm.email, 'deleted', + 'delete reason') # confirm that the account id is no longer in the queue table. self.assertFalse(rqr.check_request_remove_account(self.acc.id)) @@ -205,16 +206,17 @@ def test_update_queue_success(self): with Transaction() as t: with t.cursor() as cur: cur.execute("SELECT account_id, admin_id, disposition, " - "requested_on, reviewed_on FROM " + "requested_on, reviewed_on, delete_reason FROM " "ag.account_removal_log") rows = cur.fetchall() self.assertEqual(len(rows), 1) for account_id, admin_id, disposition, requested_on,\ - reviewed_on in rows: + reviewed_on, delete_reason in rows: # note this loop should only execute once. self.assertEqual(account_id, self.acc.id) self.assertEqual(admin_id, self.adm.id) self.assertEqual(disposition, 'deleted') + self.assertEqual(delete_reason, 'delete reason') now = datetime.datetime.now().timestamp() # the requested_on time should be not far in the past. # assume it is not NULL and is less than a minute ago. @@ -227,7 +229,7 @@ def test_update_queue_failure(self): rqr = RemovalQueueRepo(t) with self.assertRaises(InvalidTextRepresentation): - rqr.update_queue('XXXX', self.adm.email, 'ignored') + rqr.update_queue('XXXX', self.adm.email, 'ignored', None) with Transaction() as t: rqr = RemovalQueueRepo(t) @@ -238,12 +240,12 @@ def test_update_queue_failure(self): # ensure that an Error is raised when an invalid admin # email address is passed. with self.assertRaises(RepoException): - rqr.update_queue(self.acc.id, 'XXXX', 'ignored') + rqr.update_queue(self.acc.id, 'XXXX', 'ignored', None) # ensure that an Error is raised when disposition is None or # emptry string. with self.assertRaises(RepoException): - rqr.update_queue(self.acc.id, self.adm.email, None) + rqr.update_queue(self.acc.id, self.adm.email, None, None) with self.assertRaises(RepoException): - rqr.update_queue(self.acc.id, self.adm.email, '') + rqr.update_queue(self.acc.id, self.adm.email, '', None) From 8d68fc6fa4edfbe92e6deedac2dc89724e002367 Mon Sep 17 00:00:00 2001 From: ayobi Date: Mon, 5 Feb 2024 18:55:40 -0500 Subject: [PATCH 2/5] cleanup --- microsetta_private_api/db/patches/0122.sql | 3 +-- microsetta_private_api/db/patches/0136.sql | 7 +++++++ microsetta_private_api/repo/removal_queue_repo.py | 8 +++----- 3 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 microsetta_private_api/db/patches/0136.sql diff --git a/microsetta_private_api/db/patches/0122.sql b/microsetta_private_api/db/patches/0122.sql index 4c61076cb..ee2dde3e3 100644 --- a/microsetta_private_api/db/patches/0122.sql +++ b/microsetta_private_api/db/patches/0122.sql @@ -17,6 +17,5 @@ CREATE TABLE ag.account_removal_log ( -- user makes multiple requests. disposition DISPOSITION_TYPE, requested_on timestamptz, - reviewed_on timestamptz default current_timestamp, - delete_reason VARCHAR + reviewed_on timestamptz default current_timestamp ); diff --git a/microsetta_private_api/db/patches/0136.sql b/microsetta_private_api/db/patches/0136.sql new file mode 100644 index 000000000..fd3061cdc --- /dev/null +++ b/microsetta_private_api/db/patches/0136.sql @@ -0,0 +1,7 @@ +-- Feb 5, 2024 +-- Add delete_reason to ag.account_removal_log +ALTER TABLE ag.account_removal_log + ADD COLUMN delete_reason VARCHAR; + +COMMENT ON COLUMN ag.account_removal_log.delete_reason + IS 'Reason the admin gave for deleting the account.'; \ No newline at end of file diff --git a/microsetta_private_api/repo/removal_queue_repo.py b/microsetta_private_api/repo/removal_queue_repo.py index 3a90122b7..fb491f0a3 100644 --- a/microsetta_private_api/repo/removal_queue_repo.py +++ b/microsetta_private_api/repo/removal_queue_repo.py @@ -1,7 +1,5 @@ from microsetta_private_api.repo.base_repo import BaseRepo from microsetta_private_api.exceptions import RepoException -from microsetta_private_api.model.removal_queue_requests \ - import RemovalQueueRequest class RemovalQueueRepo(BaseRepo): @@ -17,9 +15,9 @@ def _check_account_is_admin(self, admin_email): return False if count == 0 else True def _row_to_removal(self, r): - return RemovalQueueRequest(r['id'], r['account_id'], r['email'], - r['first_name'], r['last_name'], - r['requested_on']) + return self.__class__(r['id'], r['account_id'], r['email'], + r['first_name'], r['last_name'], + r['requested_on']) def get_all_account_removal_requests(self): with self._transaction.dict_cursor() as cur: From 079303ee5e077c86e1e785dea4bb707682ae527a Mon Sep 17 00:00:00 2001 From: ayobi Date: Tue, 6 Feb 2024 12:08:52 -0500 Subject: [PATCH 3/5] another cleanup --- microsetta_private_api/repo/removal_queue_repo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/microsetta_private_api/repo/removal_queue_repo.py b/microsetta_private_api/repo/removal_queue_repo.py index fb491f0a3..3a90122b7 100644 --- a/microsetta_private_api/repo/removal_queue_repo.py +++ b/microsetta_private_api/repo/removal_queue_repo.py @@ -1,5 +1,7 @@ from microsetta_private_api.repo.base_repo import BaseRepo from microsetta_private_api.exceptions import RepoException +from microsetta_private_api.model.removal_queue_requests \ + import RemovalQueueRequest class RemovalQueueRepo(BaseRepo): @@ -15,9 +17,9 @@ def _check_account_is_admin(self, admin_email): return False if count == 0 else True def _row_to_removal(self, r): - return self.__class__(r['id'], r['account_id'], r['email'], - r['first_name'], r['last_name'], - r['requested_on']) + return RemovalQueueRequest(r['id'], r['account_id'], r['email'], + r['first_name'], r['last_name'], + r['requested_on']) def get_all_account_removal_requests(self): with self._transaction.dict_cursor() as cur: From 40ce74984893656b7111ffab859611ca68ac706d Mon Sep 17 00:00:00 2001 From: ayobi Date: Tue, 13 Feb 2024 13:52:56 -0500 Subject: [PATCH 4/5] added user delete reason --- microsetta_private_api/api/_removal_queue.py | 4 ++-- .../api/microsetta_private_api.yaml | 12 ++++++++++++ microsetta_private_api/api/tests/test_api.py | 3 +-- microsetta_private_api/db/patches/0137.sql | 7 +++++++ .../model/removal_queue_requests.py | 3 ++- .../repo/removal_queue_repo.py | 13 +++++++++---- .../repo/tests/test_removal_queue_repo.py | 19 ++++++++++--------- 7 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 microsetta_private_api/db/patches/0137.sql diff --git a/microsetta_private_api/api/_removal_queue.py b/microsetta_private_api/api/_removal_queue.py index 469e8fb12..384f5709c 100644 --- a/microsetta_private_api/api/_removal_queue.py +++ b/microsetta_private_api/api/_removal_queue.py @@ -15,13 +15,13 @@ def check_request_remove_account(account_id, token_info): return jsonify(result), 200 -def request_remove_account(account_id, token_info): +def request_remove_account(account_id, token_info, user_delete_reason=None): # raises 401 if method fails _validate_account_access(token_info, account_id) with Transaction() as t: rq_repo = RemovalQueueRepo(t) - rq_repo.request_remove_account(account_id) + rq_repo.request_remove_account(account_id, user_delete_reason) t.commit() return jsonify(code=200, message="Request Accepted"), 200 diff --git a/microsetta_private_api/api/microsetta_private_api.yaml b/microsetta_private_api/api/microsetta_private_api.yaml index 8e43b62e6..dc844c1c1 100644 --- a/microsetta_private_api/api/microsetta_private_api.yaml +++ b/microsetta_private_api/api/microsetta_private_api.yaml @@ -184,6 +184,12 @@ paths: description: Request account to be removed parameters: - $ref: '#/components/parameters/account_id' + - name: user_delete_reason + in: query + description: Reason for account deletion + required: false + schema: + type: string responses: '200': description: Successfully requested for account to be removed @@ -199,6 +205,12 @@ paths: description: Cancel request for account to be removed parameters: - $ref: '#/components/parameters/account_id' + - name: user_delete_reason + in: query + description: Reason for account deletion + required: false + schema: + type: string responses: '200': description: Successfully canceled request diff --git a/microsetta_private_api/api/tests/test_api.py b/microsetta_private_api/api/tests/test_api.py index fa56e4322..8304899d9 100644 --- a/microsetta_private_api/api/tests/test_api.py +++ b/microsetta_private_api/api/tests/test_api.py @@ -1422,8 +1422,7 @@ def test_request_account_removal(self): delete_reason = "User requested account removal" response = self.client.put( f'/api/accounts/{dummy_acct_id}/removal_queue', - headers=self.dummy_auth, - json={'delete_reason': delete_reason}) + headers=self.dummy_auth) self.assertEqual(200, response.status_code) diff --git a/microsetta_private_api/db/patches/0137.sql b/microsetta_private_api/db/patches/0137.sql new file mode 100644 index 000000000..6ee4d04d1 --- /dev/null +++ b/microsetta_private_api/db/patches/0137.sql @@ -0,0 +1,7 @@ +-- Feb 12, 2024 +-- Add user_delete_reason to ag.delete_account_queue +ALTER TABLE ag.delete_account_queue + ADD COLUMN user_delete_reason VARCHAR; + +COMMENT ON COLUMN ag.delete_account_queue.user_delete_reason + IS 'Reason the user gave for deleting the account.'; \ No newline at end of file diff --git a/microsetta_private_api/model/removal_queue_requests.py b/microsetta_private_api/model/removal_queue_requests.py index 5d630ad10..a0ee30d7f 100644 --- a/microsetta_private_api/model/removal_queue_requests.py +++ b/microsetta_private_api/model/removal_queue_requests.py @@ -3,7 +3,7 @@ class RemovalQueueRequest(ModelBase): def __init__(self, id, account_id, email, first_name, last_name, - requested_on): + requested_on, user_delete_reason): self.id = id self.account_id = account_id self.email = email @@ -12,6 +12,7 @@ def __init__(self, id, account_id, email, first_name, last_name, # 2022-07-27 17:15:33.937458-07:00 -> 2022-07-27 17:15:33 self.requested_on = str(requested_on).split('.')[0] + self.user_delete_reason = user_delete_reason def to_api(self): return self.__dict__.copy() diff --git a/microsetta_private_api/repo/removal_queue_repo.py b/microsetta_private_api/repo/removal_queue_repo.py index 3a90122b7..40d13a243 100644 --- a/microsetta_private_api/repo/removal_queue_repo.py +++ b/microsetta_private_api/repo/removal_queue_repo.py @@ -19,7 +19,7 @@ def _check_account_is_admin(self, admin_email): def _row_to_removal(self, r): return RemovalQueueRequest(r['id'], r['account_id'], r['email'], r['first_name'], r['last_name'], - r['requested_on']) + r['requested_on'], r['user_delete_reason']) def get_all_account_removal_requests(self): with self._transaction.dict_cursor() as cur: @@ -28,6 +28,7 @@ def get_all_account_removal_requests(self): ag.delete_account_queue.id, ag.delete_account_queue.account_id, ag.delete_account_queue.requested_on, + ag.delete_account_queue.user_delete_reason, ag.account.first_name, ag.account.last_name, ag.account.email @@ -49,7 +50,7 @@ def check_request_remove_account(self, account_id): return False if count == 0 else True - def request_remove_account(self, account_id): + def request_remove_account(self, account_id, user_delete_reason): with self._transaction.cursor() as cur: cur.execute("SELECT account_id from delete_account_queue where " "account_id = %s", (account_id,)) @@ -58,9 +59,13 @@ def request_remove_account(self, account_id): if result is not None: raise RepoException("Account is already in removal queue") + user_delete_reason_value = user_delete_reason \ + if user_delete_reason else None + cur.execute( - "INSERT INTO delete_account_queue (account_id) VALUES (%s)", - (account_id,)) + "INSERT INTO delete_account_queue (account_id, " + "user_delete_reason) VALUES (%s, %s)", + (account_id, user_delete_reason_value)) def cancel_request_remove_account(self, account_id): if not self.check_request_remove_account(account_id): diff --git a/microsetta_private_api/repo/tests/test_removal_queue_repo.py b/microsetta_private_api/repo/tests/test_removal_queue_repo.py index 8409603ec..99b009a8c 100644 --- a/microsetta_private_api/repo/tests/test_removal_queue_repo.py +++ b/microsetta_private_api/repo/tests/test_removal_queue_repo.py @@ -95,7 +95,7 @@ def test_check_request_remove_account(self): # use request_remove_account() to push the valid account onto # the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # assume request_remove_account() succeeded. # check_request_remove_account() should return True. @@ -120,7 +120,7 @@ def test_request_remove_account(self): rqr = RemovalQueueRepo(t) # use request_remove_account() to push the valid account onto # the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # assume check_request_remove_account() works correctly. # verify account is now in the queue. @@ -131,20 +131,21 @@ def test_request_remove_account_failure(self): rqr = RemovalQueueRepo(t) # remove a valid account twice - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') with self.assertRaises(RepoException): - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # remove a non-existant id. with self.assertRaises(ForeignKeyViolation): - rqr.request_remove_account(RemovalQueueTests.bad_id) + rqr.request_remove_account(RemovalQueueTests.bad_id, + 'delete reason') def test_cancel_request_remove_account(self): with Transaction() as t: rqr = RemovalQueueRepo(t) # use request_remove_account() to push the valid account onto # the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # assume check_request_remove_account() works correctly. # verify account is now in the queue. @@ -177,7 +178,7 @@ def test_cancel_request_remove_account_failure(self): # use request_remove_account() to push the valid account onto # the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # cancel the request to delete the account twice. rqr.cancel_request_remove_account(self.acc.id) @@ -189,7 +190,7 @@ def test_update_queue_success(self): rqr = RemovalQueueRepo(t) # push the standard account onto the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # update_queue should migrate the relevant information to the # ag.account_removal_log table and delete the entry from the @@ -235,7 +236,7 @@ def test_update_queue_failure(self): rqr = RemovalQueueRepo(t) # push the standard account onto the queue. - rqr.request_remove_account(self.acc.id) + rqr.request_remove_account(self.acc.id, 'delete reason') # ensure that an Error is raised when an invalid admin # email address is passed. From 21173371eb61cc58134bf5191b7f81e4bb2ecf65 Mon Sep 17 00:00:00 2001 From: ayobi Date: Tue, 13 Feb 2024 16:03:06 -0500 Subject: [PATCH 5/5] update patches --- microsetta_private_api/db/patches/0136.sql | 7 ------- microsetta_private_api/db/patches/0137.sql | 12 ++++++------ microsetta_private_api/db/patches/0138.sql | 7 +++++++ 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 microsetta_private_api/db/patches/0136.sql create mode 100644 microsetta_private_api/db/patches/0138.sql diff --git a/microsetta_private_api/db/patches/0136.sql b/microsetta_private_api/db/patches/0136.sql deleted file mode 100644 index fd3061cdc..000000000 --- a/microsetta_private_api/db/patches/0136.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Feb 5, 2024 --- Add delete_reason to ag.account_removal_log -ALTER TABLE ag.account_removal_log - ADD COLUMN delete_reason VARCHAR; - -COMMENT ON COLUMN ag.account_removal_log.delete_reason - IS 'Reason the admin gave for deleting the account.'; \ No newline at end of file diff --git a/microsetta_private_api/db/patches/0137.sql b/microsetta_private_api/db/patches/0137.sql index 6ee4d04d1..fd3061cdc 100644 --- a/microsetta_private_api/db/patches/0137.sql +++ b/microsetta_private_api/db/patches/0137.sql @@ -1,7 +1,7 @@ --- Feb 12, 2024 --- Add user_delete_reason to ag.delete_account_queue -ALTER TABLE ag.delete_account_queue - ADD COLUMN user_delete_reason VARCHAR; +-- Feb 5, 2024 +-- Add delete_reason to ag.account_removal_log +ALTER TABLE ag.account_removal_log + ADD COLUMN delete_reason VARCHAR; -COMMENT ON COLUMN ag.delete_account_queue.user_delete_reason - IS 'Reason the user gave for deleting the account.'; \ No newline at end of file +COMMENT ON COLUMN ag.account_removal_log.delete_reason + IS 'Reason the admin gave for deleting the account.'; \ No newline at end of file diff --git a/microsetta_private_api/db/patches/0138.sql b/microsetta_private_api/db/patches/0138.sql new file mode 100644 index 000000000..6ee4d04d1 --- /dev/null +++ b/microsetta_private_api/db/patches/0138.sql @@ -0,0 +1,7 @@ +-- Feb 12, 2024 +-- Add user_delete_reason to ag.delete_account_queue +ALTER TABLE ag.delete_account_queue + ADD COLUMN user_delete_reason VARCHAR; + +COMMENT ON COLUMN ag.delete_account_queue.user_delete_reason + IS 'Reason the user gave for deleting the account.'; \ No newline at end of file