fix: unique entity
This commit is contained in:
parent
bdf6dd131e
commit
eb1584f8c4
@ -4,7 +4,7 @@ import "time"
|
||||
|
||||
type Category struct {
|
||||
ID string `gorm:"primaryKey;not null" json:"id"`
|
||||
Code string `gorm:"not null" json:"code"`
|
||||
Code string `gorm:"not null;unique" json:"code"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
@ -6,8 +6,8 @@ import (
|
||||
|
||||
type Staff struct {
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"default:null" json:"username"`
|
||||
Email string `gorm:"unique,not null" json:"email"`
|
||||
Username string `gorm:"default:null;unique" json:"username"`
|
||||
Email string `gorm:"unique;not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
@ -19,7 +19,7 @@ type Subscribe struct {
|
||||
|
||||
type SubscribePlan struct {
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Code string `gorm:"not null" json:"code"`
|
||||
Code string `gorm:"not null;unique" json:"code"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
type Tag struct {
|
||||
ID string `gorm:"primaryKey;not null" json:"id"`
|
||||
Code string `gorm:"not null" json:"code"`
|
||||
Code string `gorm:"not null;unique" json:"code"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
type User struct {
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
SubscribeID string `gorm:"not null" json:"subscribe_id"`
|
||||
Email string `gorm:"unique,not null" json:"email"`
|
||||
Email string `gorm:"unique;not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
Phone string `gorm:"default:null" json:"phone"`
|
||||
Phone string `gorm:"default:not null;unique" json:"phone"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
|
||||
9
makefile
9
makefile
@ -17,9 +17,12 @@ build-migrate:
|
||||
@echo "Building the Migrate..."
|
||||
go build -o $(OUTPUT_MIGRATE_DIR) $(BINARY_MIGRATE_NAME)
|
||||
|
||||
migrate: build-migrate
|
||||
@echo "Building and running Migrate..."
|
||||
$(OUTPUT_MIGRATE_DIR)
|
||||
# migrate: build-migrate
|
||||
# @echo "Building and running Migrate..."
|
||||
# $(OUTPUT_MIGRATE_DIR)
|
||||
|
||||
migrate:
|
||||
go run $(BINARY_MIGRATE_NAME)
|
||||
|
||||
clean:
|
||||
@echo "Cleaning the build..."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user