Skip to content
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

Capture misc metadata from imported items in a column #1829

Merged
merged 2 commits into from
Feb 7, 2025
Merged

Conversation

jim
Copy link
Member

@jim jim commented Feb 4, 2025

What it does

Adds a new jsonb column to reservable_items to store arbitrary key/value metadata from imported items. This gives us a way to persist some data that doesn't map cleanly into our schema for future use. One example is that this gives us a way to capture the image URL for each item that we can later fetch and store properly.

@jim jim requested a review from a team February 4, 2025 01:47
Copy link
Contributor

@crismali crismali left a comment

Choose a reason for hiding this comment

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

👍 Looks good, I just had one question/comment that might be a bit of a "gotcha"

@@ -0,0 +1,5 @@
class AddMyturnMetaToReservableItems < ActiveRecord::Migration[7.2]
def change
add_column :reservable_items, :myturn_metadata, :jsonb, default: "{}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to double check, but does the default of "{}" actually wind up as literally a string?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, it does end up as a string. Using a plain empty Hash works as intended, though. Good catch!

@jim jim enabled auto-merge (squash) February 7, 2025 02:03
@jim jim merged commit d8e2025 into main Feb 7, 2025
9 checks passed
@jim jim deleted the jim-myturn-metadata branch February 7, 2025 02:05
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