fix: ensure all models auto increment the id field

This commit is contained in:
Derrick Hammer 2023-06-29 06:19:50 -04:00
parent 504dcefb35
commit 934f8e6236
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
7 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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"`

View File

@ -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"`

View File

@ -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

View File

@ -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

View File

@ -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"`