Signed-off-by: oppiliappan me@oppi.li
+11
-4
knotserver/db/db.go
+11
-4
knotserver/db/db.go
···
32
32
return nil, err
33
33
}
34
34
35
-
// NOTE: If any other migration is added here, you MUST
36
-
// copy the pattern in appview: use a single sql.Conn
37
-
// for every migration.
35
+
conn, err := db.Conn(ctx)
36
+
if err != nil {
37
+
return nil, err
38
+
}
39
+
defer conn.Close()
38
40
39
-
_, err = db.Exec(`
41
+
_, err = conn.ExecContext(ctx, `
40
42
create table if not exists known_dids (
41
43
did text primary key
42
44
);
···
62
64
created integer not null default (strftime('%s', 'now')),
63
65
primary key (rkey, nsid)
64
66
);
67
+
68
+
create table if not exists migrations (
69
+
id integer primary key autoincrement,
70
+
name text unique
71
+
);
65
72
`)
66
73
if err != nil {
67
74
return nil, err