refactor(core): change primary key of refund table (#5367)

This commit is contained in:
Prajjwal Kumar
2024-07-19 13:05:27 +05:30
committed by GitHub
parent e098415bb6
commit c698921c41
4 changed files with 19 additions and 2 deletions

View File

@ -1099,7 +1099,7 @@ diesel::table! {
use diesel::sql_types::*;
use crate::enums::diesel_exports::*;
refund (id) {
refund (merchant_id, refund_id) {
id -> Int4,
#[max_length = 64]
internal_reference_id -> Varchar,

View File

@ -1097,7 +1097,7 @@ diesel::table! {
use diesel::sql_types::*;
use crate::enums::diesel_exports::*;
refund (id) {
refund (merchant_id, refund_id) {
id -> Int4,
#[max_length = 64]
internal_reference_id -> Varchar,

View File

@ -0,0 +1,5 @@
-- This file should undo anything in `up.sql`
ALTER TABLE refund DROP CONSTRAINT refund_pkey;
ALTER TABLE refund
ADD PRIMARY KEY (id);

View File

@ -0,0 +1,12 @@
-- Your SQL goes here
-- The below query will lock the refund 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 refund DROP CONSTRAINT refund_pkey;
-- Use the `merchant_id, refund_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 refund
ADD PRIMARY KEY (merchant_id, refund_id);