-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(v1v2): refactor database queries for v1 and v2 #7244
base: main
Are you sure you want to change the base?
Changes from all commits
d42cf45
36d96f6
dcc0537
cbcb3d3
fced36d
8bb3a61
76fcb9c
ab96aee
1800d55
35fbaa7
c1f0fda
e4cfae4
16c3b58
7bdcc46
072e071
782a963
bafd03a
0e3d2d7
1952cad
99931a3
04b5de7
68f4f48
5ff01f1
ddef69b
35d7bcf
854da0a
fbe3f1e
c57e4ff
627ccf1
0c27611
87db6fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use serde; | ||
use utoipa::ToSchema; | ||
#[derive( | ||
Default, | ||
Clone, | ||
Debug, | ||
Comment on lines
+3
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This enum can also derive |
||
Eq, | ||
PartialEq, | ||
serde::Deserialize, | ||
serde::Serialize, | ||
strum::Display, | ||
strum::EnumString, | ||
ToSchema, | ||
Hash, | ||
)] | ||
#[router_derive::diesel_enum(storage_type = "text")] | ||
#[serde(rename_all = "snake_case")] | ||
#[strum(serialize_all = "snake_case")] | ||
pub enum MerchantProductType { | ||
Orchestration, | ||
#[default] | ||
Legacy, | ||
Vault, | ||
Recon, | ||
Recovery, | ||
CostObservability, | ||
DynamicRouting, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs | ||
index b35e809a0..749a5dd47 100644 | ||
--- a/crates/diesel_models/src/schema.rs | ||
+++ b/crates/diesel_models/src/schema.rs | ||
@@ -142,14 +142,13 @@ diesel::table! { | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use crate::enums::diesel_exports::*; | ||
|
||
- blocklist_fingerprint (id) { | ||
- id -> Int4, | ||
+ blocklist_fingerprint (merchant_id, fingerprint_id) { | ||
#[max_length = 64] | ||
merchant_id -> Varchar, | ||
#[max_length = 64] | ||
fingerprint_id -> Varchar, | ||
data_kind -> BlocklistDataKind, | ||
encrypted_fingerprint -> Text, | ||
@@ -158,14 +157,13 @@ diesel::table! { | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use crate::enums::diesel_exports::*; | ||
|
||
- blocklist_lookup (id) { | ||
- id -> Int4, | ||
+ blocklist_lookup (merchant_id, fingerprint) { | ||
#[max_length = 64] | ||
merchant_id -> Varchar, | ||
fingerprint -> Text, | ||
} | ||
} | ||
|
||
@@ -300,13 +298,12 @@ diesel::table! { | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use crate::enums::diesel_exports::*; | ||
|
||
configs (key) { | ||
- id -> Int4, | ||
#[max_length = 255] | ||
key -> Varchar, | ||
config -> Text, | ||
} | ||
} | ||
|
||
@@ -615,14 +612,13 @@ diesel::table! { | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use crate::enums::diesel_exports::*; | ||
|
||
- locker_mock_up (id) { | ||
- id -> Int4, | ||
+ locker_mock_up (card_id) { | ||
#[max_length = 255] | ||
card_id -> Varchar, | ||
#[max_length = 255] | ||
external_id -> Varchar, | ||
#[max_length = 255] | ||
card_fingerprint -> Varchar, |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,8 @@ pub struct BlocklistFingerprintNew { | |
#[derive( | ||
Clone, Debug, Eq, PartialEq, Queryable, Identifiable, Selectable, Deserialize, Serialize, | ||
)] | ||
#[diesel(table_name = blocklist_fingerprint, check_for_backend(diesel::pg::Pg))] | ||
#[diesel(table_name = blocklist_fingerprint, primary_key(merchant_id, fingerprint_id), check_for_backend(diesel::pg::Pg))] | ||
pub struct BlocklistFingerprint { | ||
#[serde(skip_serializing)] | ||
pub id: i32, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we cannot remove id from here right? This will not be backwards compatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this will not be backwards compatible. Hence we need to go for a deployment with downtime. Instead of staggering. |
||
pub merchant_id: common_utils::id_type::MerchantId, | ||
pub fingerprint_id: String, | ||
pub data_kind: common_enums::BlocklistDataKind, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,8 @@ pub struct ConfigNew { | |
} | ||
|
||
#[derive(Default, Clone, Debug, Identifiable, Queryable, Selectable, Deserialize, Serialize)] | ||
#[diesel(table_name = configs, check_for_backend(diesel::pg::Pg))] | ||
#[diesel(table_name = configs, primary_key(key), check_for_backend(diesel::pg::Pg))] | ||
pub struct Config { | ||
#[serde(skip)] | ||
pub id: i32, | ||
pub key: String, | ||
pub config: String, | ||
} | ||
|
@@ -49,7 +47,6 @@ impl From<ConfigUpdate> for ConfigUpdateInternal { | |
impl From<ConfigNew> for Config { | ||
fn from(config_new: ConfigNew) -> Self { | ||
Self { | ||
id: 0i32, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we cannot remove this as well right? this will cause downtime There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. We need to go with a downtime for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can add this in the patch for now, anyways we will need to have some downtime when deploying for v2, let's please add this in patch for now |
||
key: config_new.key, | ||
config: config_new.config, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Unnecessary import, can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am deriving serde::Deserialize and Serialize for
enum ProductType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm aware, you can directly use it in the
derive()
line, you don't need the explicituse serde;
import.