Your Question

How can I have GORM take care of tables with static data?

Say I have a table with different currencies. A simplified version could look like this:

ID Name Symbol
1 USD $
2 Euro

The content of this table is static and rarely changes.

  1. How would I create this table though the GORM migration?
  2. How can I reference it inside a struct that has a field CurrencyID which would be a foreign key for the currency.

I don't want to save the currency for each struct individually.

The document you expected this should be explained

https://gorm.io/docs/models.html

Expected answer

I want to be able to manage the content of the currency table independent of the structs which refer to it using the ID as a foreign key.

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days