Skip to content

Commit c0156f8

Browse files
committed
Start wiring in personal keys to migration
1 parent 4404af8 commit c0156f8

File tree

19 files changed

+175
-26
lines changed

19 files changed

+175
-26
lines changed

codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ module U.Codebase.Sqlite.Queries
263263
addUpgradeBranchTable,
264264
addHistoryComments,
265265
addHistoryCommentHashing,
266+
historyCommentHashingCleanup,
266267

267268
-- ** schema version
268269
currentSchemaVersion,
@@ -544,6 +545,10 @@ addHistoryCommentHashing :: Transaction ()
544545
addHistoryCommentHashing =
545546
executeStatements $(embedProjectStringFile "sql/021-hash-history-comments.sql")
546547

548+
historyCommentHashingCleanup :: Transaction ()
549+
historyCommentHashingCleanup =
550+
executeStatements $(embedProjectStringFile "sql/022-hash-history-comments-cleanup.sql")
551+
547552
schemaVersion :: Transaction SchemaVersion
548553
schemaVersion =
549554
queryOneCol

codebase2/codebase-sqlite/sql/022-after-hash-history-comments.sql renamed to codebase2/codebase-sqlite/sql/022-hash-history-comments-cleanup.sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ CREATE TABLE history_comments_new (
1111
-- using strftime('%s', 'now', 'subsec')
1212
created_at TEXT NOT NULL,
1313

14-
comment_hash_id UNIQUE INTEGER NOT NULL REFERENCES hash(id),
14+
comment_hash_id INTEGER UNIQUE NOT NULL REFERENCES hash(id),
1515
author_thumbprint_id INTEGER NOT NULL REFERENCES key_thumbprints(id)
1616
);
1717

18-
CREATE INDEX history_comments_by_causal_hash_id ON history_comments_new(causal_hash_id, created_at DESC);
1918

2019
CREATE TABLE history_comment_revisions_new (
2120
id INTEGER PRIMARY KEY,
@@ -32,10 +31,9 @@ CREATE TABLE history_comment_revisions_new (
3231
-- but you can ask to hide them.
3332
hidden BOOL NOT NULL DEFAULT FALSE,
3433

35-
revision_hash_id UNIQUE INTEGER NOT NULL REFERENCES hash(id)
34+
revision_hash_id INTEGER UNIQUE NOT NULL REFERENCES hash(id)
3635
);
3736

38-
CREATE INDEX history_comment_revisions_by_comment_id_and_created_at ON history_comment_revisions_new(comment_id, created_at DESC);
3937

4038
-- Copy data from old tables to new tables
4139
INSERT INTO history_comments_new (id, causal_hash_id, author, created_at, comment_hash_id, author_thumbprint_id)
@@ -53,3 +51,6 @@ DROP TABLE history_comment_revisions;
5351
-- Rename new tables to old table names
5452
ALTER TABLE history_comments_new RENAME TO history_comments;
5553
ALTER TABLE history_comment_revisions_new RENAME TO history_comment_revisions;
54+
55+
CREATE INDEX history_comments_by_causal_hash_id ON history_comments(causal_hash_id, created_at DESC);
56+
CREATE INDEX history_comment_revisions_by_comment_id_and_created_at ON history_comment_revisions(comment_id, created_at DESC);

codebase2/codebase-sqlite/unison-codebase-sqlite.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extra-source-files:
3131
sql/019-add-upgrade-branch-table.sql
3232
sql/020-add-history-comments.sql
3333
sql/021-hash-history-comments.sql
34+
sql/022-hash-history-comments-cleanup.sql
3435
sql/create.sql
3536

3637
source-repository head
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: unison-credentials
2+
github: unisonweb/unison
3+
copyright: Copyright (C) 2013-2025 Unison Computing, PBC and contributors
4+
5+
ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures
6+
7+
dependencies:
8+
- base
9+
- aeson
10+
- containers
11+
- jose
12+
- text
13+
- base64-bytestring
14+
- lens
15+
- memory
16+
- network-uri
17+
- time
18+
- unison-core1
19+
- unison-prelude
20+
- lock-file
21+
22+
library:
23+
source-dirs: src
24+
when:
25+
- condition: false
26+
other-modules: Paths_unison_credentials
27+
28+
default-extensions:
29+
- ApplicativeDo
30+
- BangPatterns
31+
- BlockArguments
32+
- DeriveAnyClass
33+
- DeriveFunctor
34+
- DeriveGeneric
35+
- DeriveTraversable
36+
- DerivingStrategies
37+
- DerivingVia
38+
- DoAndIfThenElse
39+
- DuplicateRecordFields
40+
- FlexibleContexts
41+
- FlexibleInstances
42+
- GeneralizedNewtypeDeriving
43+
- ImportQualifiedPost
44+
- LambdaCase
45+
- MultiParamTypeClasses
46+
- NamedFieldPuns
47+
- OverloadedStrings
48+
- PatternSynonyms
49+
- RankNTypes
50+
- ScopedTypeVariables
51+
- StandaloneDeriving
52+
- TupleSections
53+
- TypeApplications
54+
- TypeFamilies
55+
- ViewPatterns
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
cabal-version: 1.12
2+
3+
-- This file has been generated from package.yaml by hpack version 0.38.1.
4+
--
5+
-- see: https://github.com/sol/hpack
6+
7+
name: unison-credentials
8+
version: 0.0.0
9+
homepage: https://github.com/unisonweb/unison#readme
10+
bug-reports: https://github.com/unisonweb/unison/issues
11+
copyright: Copyright (C) 2013-2025 Unison Computing, PBC and contributors
12+
build-type: Simple
13+
14+
source-repository head
15+
type: git
16+
location: https://github.com/unisonweb/unison
17+
18+
library
19+
exposed-modules:
20+
Unison.Auth.CredentialFile
21+
Unison.Auth.CredentialManager
22+
Unison.Auth.PersonalKey
23+
Unison.Auth.Types
24+
hs-source-dirs:
25+
src
26+
default-extensions:
27+
ApplicativeDo
28+
BangPatterns
29+
BlockArguments
30+
DeriveAnyClass
31+
DeriveFunctor
32+
DeriveGeneric
33+
DeriveTraversable
34+
DerivingStrategies
35+
DerivingVia
36+
DoAndIfThenElse
37+
DuplicateRecordFields
38+
FlexibleContexts
39+
FlexibleInstances
40+
GeneralizedNewtypeDeriving
41+
ImportQualifiedPost
42+
LambdaCase
43+
MultiParamTypeClasses
44+
NamedFieldPuns
45+
OverloadedStrings
46+
PatternSynonyms
47+
RankNTypes
48+
ScopedTypeVariables
49+
StandaloneDeriving
50+
TupleSections
51+
TypeApplications
52+
TypeFamilies
53+
ViewPatterns
54+
ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures
55+
build-depends:
56+
aeson
57+
, base
58+
, base64-bytestring
59+
, containers
60+
, jose
61+
, lens
62+
, lock-file
63+
, memory
64+
, network-uri
65+
, text
66+
, time
67+
, unison-core1
68+
, unison-prelude
69+
default-language: Haskell2010

parser-typechecker/package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ library:
5454
- unison-codebase-sync
5555
- unison-core
5656
- unison-core1
57+
- unison-credentials
5758
- unison-hash
5859
- unison-hashing-v2
5960
- unison-prelude

0 commit comments

Comments
 (0)