why am i getting this error when i start the project
usermigration
package migrations
import (
"fmt"
"gorest/models"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
var DB *gorm.DB
var err error
const dbinfo = "host=localhost user=postgres password=***** dbname=BigDb port=5432 sslmode=disable"
func InitalMigration() {
DB, err = gorm.Open(postgres.Open(dbinfo), &gorm.Config{})
if err != nil {
fmt.Println(err.Error())
}
DB.AutoMigrate(&models.User{})
}
hata
*2022/12/27 13:56:05 C:/Users/baris/OneDrive/Masaüstü/GOREST/migrations/usermigration.go:19
[error] failed to initialize database, got error failed to connect to host=localhost user=postgres database=BigDb
: server error (FATAL: database “BigDb” does not exist (SQLSTATE 3D000))
failed to connect to host=localhost user=postgres database=BigDb
: server error (FATAL: database “BigDb” does not exist (SQLSTATE 3D000))
2022/12/27 13:56:05 C:/Users/baris/OneDrive/Masaüstü/GOREST/migrations/usermigration.go:24 failed to connect to host=localhost user=postgres database=BigDb
: server error (FATAL: database “BigDb” does not exist (SQLSTATE 3D000))
[46.255ms] [rows:-] SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = ‘users’ AND table_type = ‘BASE TABLE’
2022/12/27 13:56:05 C:/Users/baris/OneDrive/Masaüstü/GOREST/migrations/usermigration.go:24 failed to connect to host=localhost user=postgres database=BigDb
: server error (FATAL: database “BigDb” does not exist (SQLSTATE 3D000))
[45.179ms] [rows:0] CREATE TABLE “users” (“id” bigserial,“created_at” timestamptz,“updated_at” timestamptz,“deleted_at” timestamptz,“first_name” text,“last_name” text,“email” text,“password” text,PRIMARY KEY (“id”))*