mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
fix: fix migration via args failed
This commit is contained in:
parent
856823d87d
commit
b9419287e7
@ -11,7 +11,7 @@ import (
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
migrations "github.com/forfarm/backend/internal"
|
||||
"github.com/forfarm/backend/migrations"
|
||||
)
|
||||
|
||||
func MigrateCmd(ctx context.Context, dbDriver, dbSource string) *cobra.Command {
|
||||
@ -29,7 +29,7 @@ func MigrateCmd(ctx context.Context, dbDriver, dbSource string) *cobra.Command {
|
||||
|
||||
goose.SetBaseFS(migrations.EmbedMigrations)
|
||||
|
||||
if err := goose.UpContext(ctx, db, "migrations"); err != nil {
|
||||
if err := goose.UpContext(ctx, db, "."); err != nil {
|
||||
return fmt.Errorf("failed to run migrations: %w", err)
|
||||
}
|
||||
|
||||
|
||||
10
backend/makefile
Normal file
10
backend/makefile
Normal file
@ -0,0 +1,10 @@
|
||||
.PHONY: live run migrate
|
||||
|
||||
live:
|
||||
air -c .air.toml
|
||||
|
||||
run:
|
||||
go run cmd/forfarm/main.go API
|
||||
|
||||
migrate:
|
||||
go run cmd/forfarm/main.go migrate
|
||||
@ -1,3 +1,4 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
uuid UUID NOT NULL,
|
||||
@ -4,5 +4,5 @@ import (
|
||||
"embed"
|
||||
)
|
||||
|
||||
//go:embed migrations/*.sql
|
||||
//go:embed *.sql
|
||||
var EmbedMigrations embed.FS
|
||||
Loading…
Reference in New Issue
Block a user