From 934f8e6236ef1eef8db1d06a1d7a7fded8afe694 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 29 Jun 2023 06:19:50 -0400 Subject: [PATCH] fix: ensure all models auto increment the id field --- model/account.go | 2 +- model/key.go | 2 +- model/key_challenge.go | 2 +- model/login_session.go | 2 +- model/pin.go | 2 +- model/tus.go | 2 +- model/upload.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/model/account.go b/model/account.go index 7086581..50be927 100644 --- a/model/account.go +++ b/model/account.go @@ -7,7 +7,7 @@ import ( type Account struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` Email string `gorm:"uniqueIndex"` Password *string CreatedAt time.Time diff --git a/model/key.go b/model/key.go index d7f1201..dda0fc4 100644 --- a/model/key.go +++ b/model/key.go @@ -7,7 +7,7 @@ import ( type Key struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` AccountID uint Account Account Pubkey string diff --git a/model/key_challenge.go b/model/key_challenge.go index 1655a66..20bed47 100644 --- a/model/key_challenge.go +++ b/model/key_challenge.go @@ -7,7 +7,7 @@ import ( type KeyChallenge struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` AccountID uint Account Account Challenge string `gorm:"not null"` diff --git a/model/login_session.go b/model/login_session.go index 693d6ea..13070a5 100644 --- a/model/login_session.go +++ b/model/login_session.go @@ -7,7 +7,7 @@ import ( type LoginSession struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` AccountID uint Account Account Token string `gorm:"uniqueIndex"` diff --git a/model/pin.go b/model/pin.go index 4daeffa..dd89788 100644 --- a/model/pin.go +++ b/model/pin.go @@ -4,7 +4,7 @@ import "gorm.io/gorm" type Pin struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` AccountID uint `gorm:"uniqueIndex:idx_account_upload"` UploadID uint `gorm:"uniqueIndex:idx_account_upload"` Account Account diff --git a/model/tus.go b/model/tus.go index 6daea23..7dec152 100644 --- a/model/tus.go +++ b/model/tus.go @@ -6,7 +6,7 @@ import ( type Tus struct { gorm.Model - ID uint64 `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` UploadID string Hash string Info string diff --git a/model/upload.go b/model/upload.go index 0b70a14..959037d 100644 --- a/model/upload.go +++ b/model/upload.go @@ -6,7 +6,7 @@ import ( type Upload struct { gorm.Model - ID uint `gorm:"primaryKey"` + ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"` AccountID uint `gorm:"index"` Account Account Hash string `gorm:"uniqueIndex"`