Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(platform): add processor_merchant_id and created_by columns to file_metadata table and query update (#11792)
Ankit Kumar Gupta64dd2d34a759
diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rsindex 086e4841b8..941d1b017c 100644--- a/crates/diesel_models/src/file.rs+++ b/crates/diesel_models/src/file.rs@@ -19,6 +19,8 @@ pub struct FileMetadataNew {pub connector_label: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,+ pub created_by: Option<String>,}#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, Selectable)]@@ -38,6 +40,8 @@ pub struct FileMetadata {pub connector_label: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,+ pub created_by: Option<String>,}#[derive(Debug)]diff --git a/crates/diesel_models/src/query/file.rs b/crates/diesel_models/src/query/file.rsindex 5c12ed231f..b970bb97d8 100644--- a/crates/diesel_models/src/query/file.rs+++ b/crates/diesel_models/src/query/file.rs@@ -15,29 +15,59 @@ impl FileMetadataNew {}impl FileMetadata {+ pub async fn find_by_processor_merchant_id_file_id(+ conn: &PgPooledConn,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ file_id: &str,+ ) -> StorageResult<Self> {+ generics::generic_find_one::<<Self as HasTable>::Table, _, _>(+ conn,+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .and(dsl::file_id.eq(file_id.to_owned())),+ )+ .await+ }++ // Fallback function for stagger release - finds by merchant_id when processor_merchant_id is NULLpub async fn find_by_merchant_id_file_id(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> StorageResult<Self> {generics::generic_find_one::<<Self as HasTable>::Table, _, _>(conn,dsl::merchant_id- .eq(merchant_id.to_owned())+ .eq(processor_merchant_id.to_owned())+ .and(dsl::file_id.eq(file_id.to_owned())),+ )+ .await+ }++ pub async fn delete_by_processor_merchant_id_file_id(+ conn: &PgPooledConn,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ file_id: &str,+ ) -> StorageResult<bool> {+ generics::generic_delete::<<Self as HasTable>::Table, _>(+ conn,+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned()).and(dsl::file_id.eq(file_id.to_owned())),).await}+ // Fallback function for stagger release - deletes by merchant_id when processor_merchant_id is NULLpub async fn delete_by_merchant_id_file_id(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> StorageResult<bool> {generics::generic_delete::<<Self as HasTable>::Table, _>(conn,dsl::merchant_id- .eq(merchant_id.to_owned())+ .eq(processor_merchant_id.to_owned()).and(dsl::file_id.eq(file_id.to_owned())),).awaitdiff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 9607eb64f3..1fa7a07951 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -610,6 +610,10 @@ diesel::table! {profile_id -> Nullable<Varchar>,#[max_length = 32]merchant_connector_id -> Nullable<Varchar>,+ #[max_length = 64]+ processor_merchant_id -> Nullable<Varchar>,+ #[max_length = 255]+ created_by -> Nullable<Varchar>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex b215e50fae..fa0c99bde8 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -621,6 +621,10 @@ diesel::table! {profile_id -> Nullable<Varchar>,#[max_length = 32]merchant_connector_id -> Nullable<Varchar>,+ #[max_length = 64]+ processor_merchant_id -> Nullable<Varchar>,+ #[max_length = 255]+ created_by -> Nullable<Varchar>,}}diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rsindex 05bd053d8e..c8f6f5a78b 100644--- a/crates/router/src/core/disputes.rs+++ b/crates/router/src/core/disputes.rs@@ -571,7 +571,7 @@ pub async fn submit_evidence(pub async fn attach_evidence(state: SessionState,- processor: domain::Processor,+ platform: domain::Platform,profile_id: Option<common_utils::id_type::ProfileId>,attach_evidence_request: api::AttachEvidenceRequest,) -> RouterResponse<files_api_models::CreateFileResponse> {@@ -583,7 +583,7 @@ pub async fn attach_evidence(.ok_or(errors::ApiErrorResponse::MissingDisputeId)?;let dispute = db.find_dispute_by_processor_merchant_id_dispute_id(- processor.get_account().get_id(),+ platform.get_processor().get_account().get_id(),&dispute_id,).await@@ -606,7 +606,7 @@ pub async fn attach_evidence()?;let create_file_response = Box::pin(files::files_create_core(state.clone(),- processor,+ platform,attach_evidence_request.create_file_request,)).await?;diff --git a/crates/router/src/core/disputes/transformers.rs b/crates/router/src/core/disputes/transformers.rsindex 3664b4d429..166c10d502 100644--- a/crates/router/src/core/disputes/transformers.rs+++ b/crates/router/src/core/disputes/transformers.rs@@ -216,7 +216,10 @@ pub async fn get_dispute_evidence_block() -> CustomResult<api_models::disputes::DisputeEvidenceBlock, errors::ApiErrorResponse> {let file_metadata = state.store- .find_file_metadata_by_merchant_id_file_id(processor.get_account().get_id(), &file_id)+ .find_file_metadata_by_processor_merchant_id_file_id(+ processor.get_account().get_id(),+ &file_id,+ ).await.change_context(errors::ApiErrorResponse::FileNotFound).attach_printable("Unable to retrieve file_metadata")?;diff --git a/crates/router/src/core/files.rs b/crates/router/src/core/files.rsindex a3d5cac92d..4991f2b1ee 100644--- a/crates/router/src/core/files.rs+++ b/crates/router/src/core/files.rs@@ -13,19 +13,28 @@ use crate::{pub async fn files_create_core(state: SessionState,- processor: domain::Processor,+ platform: domain::Platform,create_file_request: api::CreateFileRequest,) -> RouterResponse<files::CreateFileResponse> {- helpers::validate_file_upload(&state, processor.clone(), create_file_request.clone()).await?;+ helpers::validate_file_upload(+ &state,+ platform.get_processor().clone(),+ create_file_request.clone(),+ )+ .await?;let file_id = common_utils::generate_id(consts::ID_LENGTH, "file");let file_key = format!("{}/{}",- processor.get_account().get_id().get_string_repr(),+ platform+ .get_processor()+ .get_account()+ .get_id()+ .get_string_repr(),file_id);let file_new: diesel_models::FileMetadataNew = diesel_models::file::FileMetadataNew {file_id: file_id.clone(),- merchant_id: processor.get_account().get_id().clone(),+ merchant_id: platform.get_provider().get_account().get_id().clone(),file_name: create_file_request.file_name.clone(),file_size: create_file_request.file_size,file_type: create_file_request.file_type.to_string(),@@ -35,6 +44,11 @@ pub async fn files_create_core(connector_label: None,profile_id: None,merchant_connector_id: None,+ processor_merchant_id: Some(platform.get_processor().get_account().get_id().clone()),+ created_by: platform+ .get_initiator()+ .and_then(|initiator| initiator.to_created_by())+ .map(|created_by| created_by.to_string()),};let file_metadata_object = state@@ -46,7 +60,7 @@ pub async fn files_create_core(let (provider_file_id, file_upload_provider, profile_id, merchant_connector_id) = Box::pin(helpers::upload_and_get_provider_provider_file_id_profile_id(&state,- &processor,+ platform.get_processor(),&create_file_request,file_key.clone(),),@@ -84,7 +98,10 @@ pub async fn files_delete_core(state.store.as_ref()- .delete_file_metadata_by_merchant_id_file_id(processor.get_account().get_id(), &req.file_id)+ .delete_file_metadata_by_processor_merchant_id_file_id(+ processor.get_account().get_id(),+ &req.file_id,+ ).await.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Unable to delete file_metadata")?;@@ -99,7 +116,10 @@ pub async fn files_retrieve_core(let file_metadata_object = state.store.as_ref()- .find_file_metadata_by_merchant_id_file_id(processor.get_account().get_id(), &req.file_id)+ .find_file_metadata_by_processor_merchant_id_file_id(+ processor.get_account().get_id(),+ &req.file_id,+ ).await.change_context(errors::ApiErrorResponse::FileNotFound).attach_printable("Unable to retrieve file_metadata")?;diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rsindex e999e4c5ec..d1265e1860 100644--- a/crates/router/src/core/files/helpers.rs+++ b/crates/router/src/core/files/helpers.rs@@ -91,7 +91,10 @@ pub async fn delete_file_using_file_id() -> CustomResult<(), errors::ApiErrorResponse> {let file_metadata_object = state.store- .find_file_metadata_by_merchant_id_file_id(processor.get_account().get_id(), &file_key)+ .find_file_metadata_by_processor_merchant_id_file_id(+ processor.get_account().get_id(),+ &file_key,+ ).await.change_context(errors::ApiErrorResponse::FileNotFound)?;let (provider, provider_file_id) = match (@@ -207,7 +210,7 @@ pub async fn retrieve_file_and_provider_file_id_from_file_id(Some(file_key) => {let file_metadata_object = state.store- .find_file_metadata_by_merchant_id_file_id(+ .find_file_metadata_by_processor_merchant_id_file_id(processor.get_account().get_id(),&file_key,)diff --git a/crates/router/src/db/file.rs b/crates/router/src/db/file.rsindex f81afa8d83..883ac1d193 100644--- a/crates/router/src/db/file.rs+++ b/crates/router/src/db/file.rs@@ -15,15 +15,15 @@ pub trait FileMetadataInterface {file: storage::FileMetadataNew,) -> CustomResult<storage::FileMetadata, errors::StorageError>;- async fn find_file_metadata_by_merchant_id_file_id(+ async fn find_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> CustomResult<storage::FileMetadata, errors::StorageError>;- async fn delete_file_metadata_by_merchant_id_file_id(+ async fn delete_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> CustomResult<bool, errors::StorageError>;@@ -48,27 +48,77 @@ impl FileMetadataInterface for Store {}#[instrument(skip_all)]- async fn find_file_metadata_by_merchant_id_file_id(+ async fn find_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> CustomResult<storage::FileMetadata, errors::StorageError> {let conn = connection::pg_connection_read(self).await?;- storage::FileMetadata::find_by_merchant_id_file_id(&conn, merchant_id, file_id)- .await- .map_err(|error| report!(errors::StorageError::from(error)))+ // Stagger release fallback: first try processor_merchant_id, if not found fallback to merchant_id+ // For old records processor_merchant_id is NULL, so we use merchant_id (which has the same value)+ let result = storage::FileMetadata::find_by_processor_merchant_id_file_id(+ &conn,+ processor_merchant_id,+ file_id,+ )+ .await;++ match result {+ Ok(file) => Ok(file),+ Err(error) => {+ if matches!(+ error.current_context(),+ diesel_models::errors::DatabaseError::NotFound+ ) {+ storage::FileMetadata::find_by_merchant_id_file_id(+ &conn,+ processor_merchant_id,+ file_id,+ )+ .await+ .map_err(|error| report!(errors::StorageError::from(error)))+ } else {+ Err(report!(errors::StorageError::from(error)))+ }+ }+ }}#[instrument(skip_all)]- async fn delete_file_metadata_by_merchant_id_file_id(+ async fn delete_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,file_id: &str,) -> CustomResult<bool, errors::StorageError> {let conn = connection::pg_connection_write(self).await?;- storage::FileMetadata::delete_by_merchant_id_file_id(&conn, merchant_id, file_id)- .await- .map_err(|error| report!(errors::StorageError::from(error)))+ // Stagger release fallback: first try processor_merchant_id, if not found fallback to merchant_id+ // For old records processor_merchant_id is NULL, so we use merchant_id (which has the same value)+ let result = storage::FileMetadata::delete_by_processor_merchant_id_file_id(+ &conn,+ processor_merchant_id,+ file_id,+ )+ .await;++ match result {+ Ok(success) => Ok(success),+ Err(error) => {+ if matches!(+ error.current_context(),+ diesel_models::errors::DatabaseError::NotFound+ ) {+ storage::FileMetadata::delete_by_merchant_id_file_id(+ &conn,+ processor_merchant_id,+ file_id,+ )+ .await+ .map_err(|error| report!(errors::StorageError::from(error)))+ } else {+ Err(report!(errors::StorageError::from(error)))+ }+ }+ }}#[instrument(skip_all)]@@ -94,18 +144,18 @@ impl FileMetadataInterface for MockDb {Err(errors::StorageError::MockDbError)?}- async fn find_file_metadata_by_merchant_id_file_id(+ async fn find_file_metadata_by_processor_merchant_id_file_id(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_file_id: &str,) -> CustomResult<storage::FileMetadata, errors::StorageError> {// TODO: Implement function for `MockDb`Err(errors::StorageError::MockDbError)?}- async fn delete_file_metadata_by_merchant_id_file_id(+ async fn delete_file_metadata_by_processor_merchant_id_file_id(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_file_id: &str,) -> CustomResult<bool, errors::StorageError> {// TODO: Implement function for `MockDb`diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rsindex 5f8d616a94..e0f881a229 100644--- a/crates/router/src/db/kafka_store.rs+++ b/crates/router/src/db/kafka_store.rs@@ -1184,23 +1184,23 @@ impl FileMetadataInterface for KafkaStore {self.diesel_store.insert_file_metadata(file).await}- async fn find_file_metadata_by_merchant_id_file_id(+ async fn find_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &id_type::MerchantId,+ processor_merchant_id: &id_type::MerchantId,file_id: &str,) -> CustomResult<storage::FileMetadata, errors::StorageError> {self.diesel_store- .find_file_metadata_by_merchant_id_file_id(merchant_id, file_id)+ .find_file_metadata_by_processor_merchant_id_file_id(processor_merchant_id, file_id).await}- async fn delete_file_metadata_by_merchant_id_file_id(+ async fn delete_file_metadata_by_processor_merchant_id_file_id(&self,- merchant_id: &id_type::MerchantId,+ processor_merchant_id: &id_type::MerchantId,file_id: &str,) -> CustomResult<bool, errors::StorageError> {self.diesel_store- .delete_file_metadata_by_merchant_id_file_id(merchant_id, file_id)+ .delete_file_metadata_by_processor_merchant_id_file_id(processor_merchant_id, file_id).await}diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rsindex e8137b2a93..a85b9a1fe7 100644--- a/crates/router/src/routes/disputes.rs+++ b/crates/router/src/routes/disputes.rs@@ -53,12 +53,12 @@ pub async fn retrieve_dispute(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -90,12 +90,12 @@ pub async fn fetch_disputes(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -152,7 +152,7 @@ pub async fn retrieve_disputes_list(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {@@ -215,7 +215,7 @@ pub async fn retrieve_disputes_list_profile(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {@@ -255,7 +255,7 @@ pub async fn get_disputes_filters(state: web::Data<AppState>, req: HttpRequest)},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {@@ -302,7 +302,7 @@ pub async fn get_disputes_filters_profile(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {@@ -359,12 +359,12 @@ pub async fn accept_dispute(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -411,12 +411,12 @@ pub async fn submit_dispute_evidence(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -461,21 +461,16 @@ pub async fn attach_dispute_evidence(attach_evidence_request,|state, auth: auth::AuthenticationData, req, _| {let profile_id = auth.profile.map(|profile| profile.get_id().clone());- disputes::attach_evidence(- state,- auth.platform.get_processor().clone(),- profile_id,- req,- )+ disputes::attach_evidence(state, auth.platform.clone(), profile_id, req)},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -527,12 +522,12 @@ pub async fn retrieve_dispute_evidence(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -574,12 +569,12 @@ pub async fn delete_dispute_evidence(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::ProfileDisputeWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -613,7 +608,7 @@ pub async fn get_disputes_aggregate(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {@@ -653,7 +648,7 @@ pub async fn get_disputes_aggregate_profile(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {diff --git a/crates/router/src/routes/files.rs b/crates/router/src/routes/files.rsindex 37afc22f05..97d6e3e87a 100644--- a/crates/router/src/routes/files.rs+++ b/crates/router/src/routes/files.rs@@ -47,15 +47,15 @@ pub async fn files_create(&req,create_file_request,|state, auth: auth::AuthenticationData, req, _| {- files_create_core(state, auth.platform.get_processor().clone(), req)+ files_create_core(state, auth.platform.clone(), req)},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::DashboardNoPermissionAuth {- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -103,11 +103,11 @@ pub async fn files_delete(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::DashboardNoPermissionAuth {- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -157,11 +157,11 @@ pub async fn files_retrieve(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::DashboardNoPermissionAuth {- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),diff --git a/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/down.sql b/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/down.sqlnew file mode 100644index 0000000000..166b387ca7--- /dev/null+++ b/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/down.sql@@ -0,0 +1,3 @@+-- This file should undo anything in `up.sql`+ALTER TABLE file_metadata DROP COLUMN IF EXISTS processor_merchant_id;+ALTER TABLE file_metadata DROP COLUMN IF EXISTS created_by;\ No newline at end of filediff --git a/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/up.sql b/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/up.sqlnew file mode 100644index 0000000000..c2ea45eeec--- /dev/null+++ b/migrations/2026-04-13-075818_add_processor_merchant_id_created_by_to_file_metadata/up.sql@@ -0,0 +1,6 @@+-- Your SQL goes here+ALTER TABLE file_metadata ADD COLUMN IF NOT EXISTS processor_merchant_id VARCHAR(64);+ALTER TABLE file_metadata ADD COLUMN IF NOT EXISTS created_by VARCHAR(255);++-- This backfill should be executed after deployment is complete.+UPDATE file_metadata SET processor_merchant_id = merchant_id WHERE processor_merchant_id IS NULL;