Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add a migration to backfill webhook subscribers with a missing secret key

Stefan Vermaasd7a14024d2f3
diff --git a/api/db/migrate/20230116204600_backfill_secret_key_for_spree_webhooks_subscribers.rb b/api/db/migrate/20230116204600_backfill_secret_key_for_spree_webhooks_subscribers.rb
new file mode 100644
index 0000000000..cb80ba6c38
--- /dev/null
+++ b/api/db/migrate/20230116204600_backfill_secret_key_for_spree_webhooks_subscribers.rb
@@ -0,0 +1,5 @@
+class BackfillSecretKeyForSpreeWebhooksSubscribers < ActiveRecord::Migration[7.0]
+ def change
+ Spree::Webhooks::Subscriber.where(secret_key: nil).find_each(&:regenerate_secret_key)
+ end
+end