Skip to content

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Apr 24, 2025

Skip metafield migrations when:

  • create: skip when metafield already exists
  • update: skip when metafield doesn't exist
  • remove: skip when metafield doesn't exist

Example of output:

Running Rails from: /path/to/app
== migrating ==================================================================
-- create_metafield(:article, :collection, :collection_reference)
-- Metafield custom:collection already exists for article, skipping creation
   -> 0.3110s
-- create_metafield(:article, :category, :single_line_text_field)
-- Metafield custom:category already exists for article, skipping creation
   -> 0.2828s
== migrated (0.6152s) =========================================================

== migrating ==================================================================
-- create_metafield(:article, :collection, :collection_reference)
-- Metafield custom:collection already exists for article, skipping creation
   -> 0.3480s
-- update_metafield(:article, :xyz)
-- Metafield custom:xyz not found for article, skipping update
   -> 0.3251s
-- remove_metafield(:article, :xyz_test)
-- Metafield custom:xyz_test not found for article, skipping deletion
   -> 0.2981s
== migrated (0.9743s) =======================================================

Skip metafield migrations when:

- create: skip when metafield already exists
- update: skip when metafield doesn't exist
- remove: skip when metafield doesn't exist
@kennyadsl kennyadsl requested review from elia and gianlukk994 April 24, 2025 06:45
@kennyadsl kennyadsl self-assigned this Apr 24, 2025
Copy link
Contributor

@gianlukk994 gianlukk994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

@kennyadsl kennyadsl merged commit 5671bf7 into main Apr 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants