Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/db/diff/migra.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"bytes"
"context"
_ "embed"
"strings"

Check failure on line 7 in internal/db/diff/migra.go

View workflow job for this annotation

GitHub Actions / Lint

File is not properly formatted (gofmt)
"regexp"

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
Expand Down Expand Up @@ -147,5 +148,12 @@
); err != nil && !strings.HasPrefix(stderr.String(), "main worker has been destroyed") {
return "", errors.Errorf("error diffing schema: %w:\n%s", err, stderr.String())
}
return out.String(), nil
// TODO: migra does not support ignoring functions yet
return filterFunctionBody(out.String()), nil
}

var grantFuncPattern = regexp.MustCompile(`(?s)CREATE OR REPLACE FUNCTION extensions.grant_pg_(cron|net)_access.+?END;\$function\$;`)

func filterFunctionBody(diff string) string {
return grantFuncPattern.ReplaceAllString(diff, "")
}
2 changes: 1 addition & 1 deletion internal/db/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
errMissing = errors.New("No migrations found")
errInSync = errors.New("No schema changes found")
errConflict = errors.Errorf("The remote database's migration history does not match local files in %s directory.", utils.MigrationsDir)
managedSchemas = []string{"auth", "storage", "realtime"}
managedSchemas = []string{"auth", "storage", "realtime", "extensions"}
)

func Run(ctx context.Context, schema []string, config pgconn.Config, name string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
Expand Down
Loading