migration create extension uuid-ossp

This commit is contained in:
valitovgaziz
2024-08-13 16:33:46 +05:00
parent 2a3c5c8f64
commit 45a13df2b9
2 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -3,9 +3,9 @@ package models
import "github.com/google/uuid" import "github.com/google/uuid"
type User struct { type User struct {
Id uuid.UUID `json:"id" gorm:"type:uuid;default:uuid_generate_v4;primaryKey;unique;AutoIncrement:false"` Id uuid.UUID `json:"id" gorm:"type:uuid;default:uuid_generate_v4();primaryKey;unique;AutoIncrement:false"`
Name string `json:"name" gorm:"type:string"` Name string `json:"name" gorm:"type:string"`
Email string `json:"email" gorm:"type:string;index"` Email string `json:"email" gorm:"type:string;index"`
Password string `json:"password" gorm:"type:string;index"` Password string `json:"password" gorm:"type:string;index"`
Phone string `json:"phone" gorm:"type:string;index"` Phone string `json:"phone" gorm:"type:string;index"`
} }
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP EXTENSION "uuid-ossp";
-- +goose StatementEnd