From f4cad689d8a3235148f3ff26d3d1048bc98aabe1 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 19:19:48 +0200 Subject: [PATCH] Add ExchangeRate entity to database --- db/db.go | 1 + db/exchange_rate.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 db/exchange_rate.go diff --git a/db/db.go b/db/db.go index 9662b70..1f1ef33 100644 --- a/db/db.go +++ b/db/db.go @@ -71,6 +71,7 @@ func Connect() *gorm.DB { gormDB.AutoMigrate(&Expense{}) gormDB.AutoMigrate(&Metric{}) gormDB.AutoMigrate(&Currency{}) + gormDB.AutoMigrate(&ExchangeRate{}) return newUDB } diff --git a/db/exchange_rate.go b/db/exchange_rate.go new file mode 100644 index 0000000..d3f4eb7 --- /dev/null +++ b/db/exchange_rate.go @@ -0,0 +1,14 @@ +package db + +import "gorm.io/gorm" + +type ExchangeRate struct { + gorm.Model + FromCurrID uint + FromCurr *Currency + From uint64 + ToCurrID uint + ToCurr *Currency + To uint64 + Rate uint64 +}