(ctx context.DnoteCtx, schemaKey string)
| 55 | } |
| 56 | |
| 57 | func 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 | |
| 70 | func getSchemaKey(mode int) (string, error) { |
| 71 | if mode == LocalMode { |