Golang migrator added. Need switch to gooos.

This commit is contained in:
valitovgaziz
2024-08-05 23:27:46 +05:00
parent 87de968e7f
commit 25126c176f
8 changed files with 25 additions and 1 deletions
+1
View File
@@ -4,3 +4,4 @@ DB_NAME=postgres
DB_PORT=5432
HOST_DB=db
SERVER_PORT=8000
POSTGRESQL_URL='postgres://postgres:postgres@db:5432/postgres?sslmode=disable'
+2
View File
@@ -8,4 +8,6 @@ RUN go mod tidy
RUN go build -o bin/api.exe cmd/main.go
RUN
ENTRYPOINT [ "bin/api.exe" ]
@@ -0,0 +1 @@
DROP TABLE IF EXISTS users;
@@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXIST users(
id UUID PRIMARY KEY,
name VARCHAR(50) NOT NULL,
password VARCHAR(50) NOT NULL,
email VARCHAR(300) UNIQUE NOT NULL
);
+1
View File
@@ -25,6 +25,7 @@ require (
require (
github.com/fatih/color v1.17.0 // indirect
github.com/google/uuid v1.6.0
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jinzhu/gorm v1.9.16
github.com/mattn/go-colorable v0.1.13 // indirect
+2
View File
@@ -11,6 +11,8 @@ github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4=
github.com/ilyakaznacheev/cleanenv v1.5.0/go.mod h1:a5aDzaJrLCQZsazHol1w8InnDcOX0OColm64SlIi6gk=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
+11
View File
@@ -0,0 +1,11 @@
package models
import "github.com/google/uuid"
type User struct {
Id uuid.UUID `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
Phone string `json:"phone"`
}
View File