fix: ensure all models auto increment the id field
This commit is contained in:
parent
504dcefb35
commit
934f8e6236
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"`
|
||||||
|
|
|
@ -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"`
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"`
|
||||||
|
|
Loading…
Reference in New Issue