Issue:
Bug: refactor: change primary keys in user, user_roles & roles tables



## Description

Previously our tables  namely:
users
user_roles
roles
has primary key as ID.
we are refactoring them as follows:

users => user_id
user_roles => (user_id, merchant_id)
roles => role_id

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
Changing the primary key of the following table from (id) to the specified new keys:
users => user_id
user_roles => (user_id, merchant_id)
roles => role_id

### Additional Changes

- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Required for api_v2

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Checked by compiling the code

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:

Checked by compiling the code

Patch:
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 4b5f4a8ad49..b8c5344cbbb 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1168,7 +1168,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    roles (id) {
+    roles (role_id) {
         id -> Int4,
         #[max_length = 64]
         role_name -> Varchar,
@@ -1251,7 +1251,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    user_roles (id) {
+    user_roles (user_id, merchant_id) {
         id -> Int4,
         #[max_length = 64]
         user_id -> Varchar,
@@ -1275,7 +1275,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    users (id) {
+    users (user_id) {
         id -> Int4,
         #[max_length = 64]
         user_id -> Varchar,
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index a2e35a6d6a9..c831bbfa709 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1166,7 +1166,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    roles (id) {
+    roles (role_id) {
         id -> Int4,
         #[max_length = 64]
         role_name -> Varchar,
@@ -1249,7 +1249,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    user_roles (id) {
+    user_roles (user_id, merchant_id) {
         id -> Int4,
         #[max_length = 64]
         user_id -> Varchar,
@@ -1273,7 +1273,7 @@ diesel::table! {
     use diesel::sql_types::*;
     use crate::enums::diesel_exports::*;
 
-    users (id) {
+    users (user_id) {
         id -> Int4,
         #[max_length = 64]
         user_id -> Varchar,
diff --git a/migrations/2024-07-19-095541_change_primary_key_for_users/down.sql b/migrations/2024-07-19-095541_change_primary_key_for_users/down.sql
new file mode 100644
index 00000000000..6ba57be2af4
--- /dev/null
+++ b/migrations/2024-07-19-095541_change_primary_key_for_users/down.sql
@@ -0,0 +1,5 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE users DROP CONSTRAINT users_pkey;
+
+ALTER TABLE users
+ADD PRIMARY KEY (id);
diff --git a/migrations/2024-07-19-095541_change_primary_key_for_users/up.sql b/migrations/2024-07-19-095541_change_primary_key_for_users/up.sql
new file mode 100644
index 00000000000..3d53115c172
--- /dev/null
+++ b/migrations/2024-07-19-095541_change_primary_key_for_users/up.sql
@@ -0,0 +1,12 @@
+-- Your SQL goes here
+-- The below query will lock the users table
+-- Running this query is not necessary on higher environments
+-- as the application will work fine without these queries being run
+-- This query should be run after the new version of application is deployed
+ALTER TABLE users DROP CONSTRAINT users_pkey;
+
+-- Use the `user_id` columns as primary key
+-- These are already unique, not null column
+-- So this query should not fail for not null or duplicate value reasons
+ALTER TABLE users
+ADD PRIMARY KEY (user_id);
diff --git a/migrations/2024-07-19-100016_change_primary_key_for_user_roles/down.sql b/migrations/2024-07-19-100016_change_primary_key_for_user_roles/down.sql
new file mode 100644
index 00000000000..47b9f679c40
--- /dev/null
+++ b/migrations/2024-07-19-100016_change_primary_key_for_user_roles/down.sql
@@ -0,0 +1,5 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE user_roles DROP CONSTRAINT user_roles_pkey;
+
+ALTER TABLE user_roles
+ADD PRIMARY KEY (id);
diff --git a/migrations/2024-07-19-100016_change_primary_key_for_user_roles/up.sql b/migrations/2024-07-19-100016_change_primary_key_for_user_roles/up.sql
new file mode 100644
index 00000000000..65d9c61fcb8
--- /dev/null
+++ b/migrations/2024-07-19-100016_change_primary_key_for_user_roles/up.sql
@@ -0,0 +1,12 @@
+-- Your SQL goes here
+-- The below query will lock the user_roles table
+-- Running this query is not necessary on higher environments
+-- as the application will work fine without these queries being run
+-- This query should be run after the new version of application is deployed
+ALTER TABLE user_roles DROP CONSTRAINT user_roles_pkey;
+
+-- Use the `user_id, merchant_id` columns as primary key
+-- These are already unique, not null columns
+-- So this query should not fail for not null or duplicate value reasons
+ALTER TABLE user_roles
+ADD PRIMARY KEY (user_id, merchant_id);
diff --git a/migrations/2024-07-19-100936_change_primary_key_for_roles/down.sql b/migrations/2024-07-19-100936_change_primary_key_for_roles/down.sql
new file mode 100644
index 00000000000..70e4d1674af
--- /dev/null
+++ b/migrations/2024-07-19-100936_change_primary_key_for_roles/down.sql
@@ -0,0 +1,5 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE roles DROP CONSTRAINT roles_pkey;
+
+ALTER TABLE roles
+ADD PRIMARY KEY (id);
diff --git a/migrations/2024-07-19-100936_change_primary_key_for_roles/up.sql b/migrations/2024-07-19-100936_change_primary_key_for_roles/up.sql
new file mode 100644
index 00000000000..8bde2a3b426
--- /dev/null
+++ b/migrations/2024-07-19-100936_change_primary_key_for_roles/up.sql
@@ -0,0 +1,12 @@
+-- Your SQL goes here
+-- The below query will lock the user_roles table
+-- Running this query is not necessary on higher environments
+-- as the application will work fine without these queries being run
+-- This query should be run after the new version of application is deployed
+ALTER TABLE roles DROP CONSTRAINT roles_pkey;
+
+-- Use the `role_id` column as primary key
+-- These are already unique, not null column
+-- So this query should not fail for not null or duplicate value reasons
+ALTER TABLE roles
+ADD PRIMARY KEY (role_id);