add v1 GET endpoints
This commit is contained in:
25
database/connection.go
Normal file
25
database/connection.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var DB *gorm.DB
|
||||
var err error
|
||||
|
||||
func CreateConnection() {
|
||||
DB, err = gorm.Open(postgres.Open(os.Getenv("DATABASE_URL")), &gorm.Config{})
|
||||
|
||||
if err != nil {
|
||||
panic("failed to connect database")
|
||||
}
|
||||
DB.AutoMigrate(
|
||||
&Quote{},
|
||||
&QuoteLine{},
|
||||
&Image{},
|
||||
&Admincard{},
|
||||
&Splash{})
|
||||
}
|
||||
Reference in New Issue
Block a user