feat: add PostgreSQL persistence layer with Neon DB support
This commit is contained in:
20
internal/db/migrate.go
Normal file
20
internal/db/migrate.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
//go:embed migrations/001_init.sql
|
||||
var initSQL string
|
||||
|
||||
func Migrate(pool *pgxpool.Pool) error {
|
||||
_, err := pool.Exec(context.Background(), initSQL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("run migration: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user