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 { type Account struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
Email string `gorm:"uniqueIndex"` Email string `gorm:"uniqueIndex"`
Password *string Password *string
CreatedAt time.Time CreatedAt time.Time

View File

@ -7,7 +7,7 @@ import (
type Key struct { type Key struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
AccountID uint AccountID uint
Account Account Account Account
Pubkey string Pubkey string

View File

@ -7,7 +7,7 @@ import (
type KeyChallenge struct { type KeyChallenge struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
AccountID uint AccountID uint
Account Account Account Account
Challenge string `gorm:"not null"` Challenge string `gorm:"not null"`

View File

@ -7,7 +7,7 @@ import (
type LoginSession struct { type LoginSession struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
AccountID uint AccountID uint
Account Account Account Account
Token string `gorm:"uniqueIndex"` Token string `gorm:"uniqueIndex"`

View File

@ -4,7 +4,7 @@ import "gorm.io/gorm"
type Pin struct { type Pin struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
AccountID uint `gorm:"uniqueIndex:idx_account_upload"` AccountID uint `gorm:"uniqueIndex:idx_account_upload"`
UploadID uint `gorm:"uniqueIndex:idx_account_upload"` UploadID uint `gorm:"uniqueIndex:idx_account_upload"`
Account Account Account Account

View File

@ -6,7 +6,7 @@ import (
type Tus struct { type Tus struct {
gorm.Model gorm.Model
ID uint64 `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
UploadID string UploadID string
Hash string Hash string
Info string Info string

View File

@ -6,7 +6,7 @@ import (
type Upload struct { type Upload struct {
gorm.Model gorm.Model
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey" gorm:"AUTO_INCREMENT"`
AccountID uint `gorm:"index"` AccountID uint `gorm:"index"`
Account Account Account Account
Hash string `gorm:"uniqueIndex"` Hash string `gorm:"uniqueIndex"`