···21 domain text not null unique,
22 did text not null,
23 secret text not null,
24- created integer default (strftime('%s', 'now')),
25- registered integer);
026 create table if not exists public_keys (
27 id integer primary key autoincrement,
28 did text not null,
29 name text not null,
30 key text not null,
31- created integer default (strftime('%s', 'now')),
32 unique(did, name, key)
33 );
34 create table if not exists repos (
···36 did text not null,
37 name text not null,
38 knot text not null,
39- created integer default (strftime('%s', 'now')),
40 unique(did, name, knot)
41 );
42 `)
···21 domain text not null unique,
22 did text not null,
23 secret text not null,
24+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
25+ registered text
26+ );
27 create table if not exists public_keys (
28 id integer primary key autoincrement,
29 did text not null,
30 name text not null,
31 key text not null,
32+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
33 unique(did, name, key)
34 );
35 create table if not exists repos (
···37 did text not null,
38 name text not null,
39 knot text not null,
40+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
41 unique(did, name, knot)
42 );
43 `)
+9-7
appview/db/pubkeys.go
···21 Did string `json:"did"`
22 Key string `json:"key"`
23 Name string `json:"name"`
24- Created time.Time
25}
2627func (p PublicKey) MarshalJSON() ([]byte, error) {
28 type Alias PublicKey
29 return json.Marshal(&struct {
30- Created int64 `json:"created"`
31 *Alias
32 }{
33- Created: p.Created.Unix(),
34 Alias: (*Alias)(&p),
35 })
36}
···4647 for rows.Next() {
48 var publicKey PublicKey
49- var createdAt *int64
50 if err := rows.Scan(&publicKey.Key, &publicKey.Name, &publicKey.Did, &createdAt); err != nil {
51 return nil, err
52 }
53- publicKey.Created = time.Unix(*createdAt, 0)
054 keys = append(keys, publicKey)
55 }
56···7273 for rows.Next() {
74 var publicKey PublicKey
75- var createdAt *int64
76 if err := rows.Scan(&publicKey.Did, &publicKey.Key, &publicKey.Name, &createdAt); err != nil {
77 return nil, err
78 }
79- publicKey.Created = time.Unix(*createdAt, 0)
080 keys = append(keys, publicKey)
81 }
82
···25 id integer primary key autoincrement,
26 did text not null,
27 key text not null,
28- created timestamp default current_timestamp,
29 unique(did, key),
30 foreign key (did) references known_dids(did) on delete cascade
31 );
···35 did text not null,
36 name text not null,
37 description text not null,
38- created timestamp default current_timestamp,
39 unique(did, name)
40 );
41
···25 id integer primary key autoincrement,
26 did text not null,
27 key text not null,
28+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
29 unique(did, key),
30 foreign key (did) references known_dids(did) on delete cascade
31 );
···35 did text not null,
36 name text not null,
37 description text not null,
38+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
39 unique(did, name)
40 );
41