From d41e6301e5d59682a90d43ab020ef95c9e0c4b91 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 18:44:23 +0200 Subject: [PATCH] Add Currency entity to database --- db/currency.go | 14 ++++++++++++++ db/db.go | 1 + 2 files changed, 15 insertions(+) create mode 100644 db/currency.go diff --git a/db/currency.go b/db/currency.go new file mode 100644 index 0000000..cdd3358 --- /dev/null +++ b/db/currency.go @@ -0,0 +1,14 @@ +package db + +import "gorm.io/gorm" + +type Currency struct { + gorm.Model + Name string + ISOName string + Symbol string +} + +func (c Currency) GetID() uint { + return c.ID +} diff --git a/db/db.go b/db/db.go index 2e116e9..376fe61 100644 --- a/db/db.go +++ b/db/db.go @@ -70,6 +70,7 @@ func Connect() *gorm.DB { gormDB.AutoMigrate(&Session{}) gormDB.AutoMigrate(&Expense{}) gormDB.AutoMigrate(&Metric{}) + gormDB.AutoMigrate(&Currency{}) return newUDB }