mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 03:13:56 +08:00
refactor(core): change primary keys in user, user_roles and roles tables (#5374)
This commit is contained in:
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
Reference in New Issue
Block a user