Skip to content

Commit 3a9a11c

Browse files
committed
Merge branch '659-create-snapshot-command' into 'master'
fix: snapshot creation using the CLI 'snapshot create' command (#659) Closes #659 See merge request postgres-ai/database-lab!1061
2 parents a9448e7 + 0a86365 commit 3a9a11c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

engine/internal/srv/routes.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"net/http"
88
"os"
9+
"path"
910
"sort"
1011
"strconv"
1112
"strings"
@@ -515,9 +516,9 @@ func (s *Server) createSnapshotClone(w http.ResponseWriter, r *http.Request) {
515516
return
516517
}
517518

518-
cloneName := clone.ID
519+
fullClonePath := path.Join(branching.BranchDir, clone.Branch, clone.ID, branching.RevisionSegment(branching.DefaultRevision))
519520

520-
snapshotID, err := fsm.CreateSnapshot(cloneName, time.Now().Format(util.DataStateAtFormat))
521+
snapshotID, err := fsm.CreateSnapshot(fullClonePath, time.Now().Format(util.DataStateAtFormat))
521522
if err != nil {
522523
api.SendBadRequestError(w, r, fmt.Sprintf("failed to create a snapshot: %s", err.Error()))
523524
return

engine/test/1.synthetic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ dblab clone create \
263263
--branch 001-branch \
264264
--id branchclone002 || (echo "Failed to create a clone on branch" && exit 1)
265265

266-
dblab commit --clone-id branchclone002 -m branchclone002 || (echo "Failed to create a snapshot" && exit 1)
266+
dblab snapshot create --clone-id branchclone002 --message branchclone002 || (echo "Failed to create a snapshot" && exit 1)
267267

268268
dblab log 001-branch || (echo "Failed to show branch history" && exit 1)
269269

0 commit comments

Comments
 (0)