initial
This commit is contained in:
22
src/ma/database/migrate_database.go
Normal file
22
src/ma/database/migrate_database.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"log"
|
||||
//"time"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func Migrate() {
|
||||
dsn := ""
|
||||
db, err := gorm.Open(postgres.Open(dsn))
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to open database connection: %s", err)
|
||||
}
|
||||
|
||||
db.AutoMigrate(&Message{})
|
||||
log.Println("Message created")
|
||||
|
||||
log.Println("Remember to call create_hypertable on message, sowhat I can't do that for you.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user