MCPcopy
hub / github.com/dnote/dnote / initSchema

Function initSchema

pkg/cli/migrate/migrate.go:57–68  ·  view source on GitHub ↗
(ctx context.DnoteCtx, schemaKey string)

Source from the content-addressed store, hash-verified

55}
56
57func initSchema(ctx context.DnoteCtx, schemaKey string) (int, error) {
58 // schemaVersion is the index of the latest run migration in the sequence
59 schemaVersion := 0
60
61 db := ctx.DB
62 _, err := db.Exec("INSERT INTO system (key, value) VALUES (?, ?)", schemaKey, schemaVersion)
63 if err != nil {
64 return schemaVersion, errors.Wrap(err, "inserting schema")
65 }
66
67 return schemaVersion, nil
68}
69
70func getSchemaKey(mode int) (string, error) {
71 if mode == LocalMode {

Callers 1

getSchemaFunction · 0.85

Calls 1

ExecMethod · 0.65

Tested by

no test coverage detected