refactor(db): extract Supabase migrations from release artifact
This commit is contained in:
parent
2ef37683cb
commit
7d9e518f86
20 changed files with 113 additions and 185 deletions
internal/controller
|
@ -36,6 +36,7 @@ import (
|
|||
supabasev1alpha1 "code.icb4dc0.de/prskr/supabase-operator/api/v1alpha1"
|
||||
"code.icb4dc0.de/prskr/supabase-operator/assets/migrations"
|
||||
"code.icb4dc0.de/prskr/supabase-operator/internal/db"
|
||||
"code.icb4dc0.de/prskr/supabase-operator/internal/errx"
|
||||
"code.icb4dc0.de/prskr/supabase-operator/internal/meta"
|
||||
"code.icb4dc0.de/prskr/supabase-operator/internal/supabase"
|
||||
)
|
||||
|
@ -69,7 +70,7 @@ func (r *CoreDbReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
|
|||
return ctrl.Result{RequeueAfter: 30 * time.Second}, nil
|
||||
}
|
||||
|
||||
defer CloseCtx(ctx, conn, &err)
|
||||
defer errx.CloseCtx(ctx, conn, &err)
|
||||
|
||||
logger.Info("Connected to database, checking for outstanding migrations")
|
||||
if err := r.applyMissingMigrations(ctx, conn, &core); err != nil {
|
||||
|
|
|
@ -68,7 +68,7 @@ var _ = Describe("Dashboard Controller", func() {
|
|||
})
|
||||
It("should successfully reconcile the resource", func() {
|
||||
By("Reconciling the created resource")
|
||||
controllerReconciler := &DashboardReconciler{
|
||||
controllerReconciler := &DashboardPGMetaReconciler{
|
||||
Client: k8sClient,
|
||||
Scheme: k8sClient.Scheme(),
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ package controller
|
|||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"io"
|
||||
"maps"
|
||||
"reflect"
|
||||
|
||||
|
@ -20,17 +18,6 @@ import (
|
|||
"code.icb4dc0.de/prskr/supabase-operator/api"
|
||||
)
|
||||
|
||||
func Close(closer io.Closer, err *error) {
|
||||
*err = errors.Join(*err, closer.Close())
|
||||
}
|
||||
|
||||
func CloseCtx(ctx context.Context, closable interface {
|
||||
Close(ctx context.Context) error
|
||||
}, err *error,
|
||||
) {
|
||||
*err = errors.Join(*err, closable.Close(ctx))
|
||||
}
|
||||
|
||||
func ptrOf[T any](val T) *T {
|
||||
return &val
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue