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
fix(user_roles): migrations for backfilling user_roles entity_id (#6837)
Riddhiagrawal001986de77b4868
diff --git a/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql b/migrations/2024-12-02-110129_update-user-role-entity-type/down.sqlindex c7c9cbeb40..dff040ebc9 100644--- a/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql+++ b/migrations/2024-12-02-110129_update-user-role-entity-type/down.sql@@ -1,2 +1,2 @@-- This file should undo anything in `up.sql`-SELECT 1;\ No newline at end of file+UPDATE user_roles SET entity_type = NULL WHERE version = 'v1';\ No newline at end of filediff --git a/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql b/migrations/2024-12-02-110129_update-user-role-entity-type/up.sqlindex f2759f030d..b982a8b137 100644--- a/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql+++ b/migrations/2024-12-02-110129_update-user-role-entity-type/up.sql@@ -1,4 +1,5 @@-- Your SQL goes here+-- Incomplete migration, also run migrations/2024-12-13-080558_entity-id-backfill-for-user-rolesUPDATE user_rolesSETentity_type = CASEdiff --git a/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sqlnew file mode 100644index 0000000000..fb372f88a1--- /dev/null+++ b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+UPDATE user_roles SET entity_id = NULL WHERE version = 'v1';\ No newline at end of filediff --git a/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sqlnew file mode 100644index 0000000000..7de41d880d--- /dev/null+++ b/migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql@@ -0,0 +1,10 @@+-- Your SQL goes here+UPDATE user_roles+SET+ entity_id = CASE+ WHEN role_id = 'org_admin' THEN org_id+ ELSE merchant_id+ END+WHERE+ version = 'v1'+ AND entity_id IS NULL;\ No newline at end of file