Skip to content

Commit

Permalink
fix migrations after merging V8
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jun 16, 2023
1 parent c32c832 commit f5a335d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ALTER TABLE "access_token_legacy" RENAME CONSTRAINT "ACCESS_FK_VAULT" TO "ACCESS

-- as soon as a device gets verified by its owner, the owner's private key will be encrypted for this device:
ALTER TABLE "device" ADD "user_key" VARCHAR(2000) UNIQUE; -- private key, encrypted using device's public key (JWE ECDH-ES)
ALTER TABLE "device" ADD "type" VARCHAR(255) NOT NULL;
ALTER TABLE "device" ADD "last_seen_time" TIMESTAMP WITH TIME ZONE NOT NULL;
COMMENT ON COLUMN "device"."publickey" IS 'Note: This contains base64url-encoded data for historic reasons.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void removingUserCascadesToAccess() throws SQLException {
s.execute("""
INSERT INTO "authority" ("id", "type", "name") VALUES ('user999', 'USER', 'User 999');
INSERT INTO "user_details" ("id") VALUES ('user999');
INSERT INTO "access_token" ("user_id", "vault_id", "vault_key_jwe") VALUES ('user999', '7E57C0DE-0000-4000-8000-000100001111', 'jwe4');
INSERT INTO "access_token" ("user_id", "vault_id", "vault_key") VALUES ('user999', '7E57C0DE-0000-4000-8000-000100001111', 'jwe4');
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ VALUES
('7E57C0DE-0000-4000-8000-000100001111', 'user2', 'MEMBER'),
('7E57C0DE-0000-4000-8000-000100002222', 'group1', 'MEMBER');

INSERT INTO "device" ("id", "owner_id", "name", "type", "publickey", "creation_time", "last_seen_time", "user_key_jwe")
INSERT INTO "device" ("id", "owner_id", "name", "type", "publickey", "creation_time", "last_seen_time", "user_key")
VALUES
('device1', 'user1', 'Computer 1', 'DESKTOP', 'publickey1', '2020-02-20 20:20:20', '2023-01-11 22:33:44', 'jwe.jwe.jwe.user1.device1'),
('device2', 'user2', 'Computer 2', 'DESKTOP', 'publickey2', '2020-02-20 20:20:20', '2023-01-11 22:33:44', 'jwe.jwe.jwe.user2.device2'),
('device3', 'user1', 'Computer 3', 'DESKTOP', 'publickey3', '2020-02-20 20:20:20', '2023-01-11 22:33:44', NULL);

INSERT INTO "access_token" ("user_id", "vault_id", "vault_key_jwe")
INSERT INTO "access_token" ("user_id", "vault_id", "vault_key")
VALUES
('user1', '7E57C0DE-0000-4000-8000-000100001111', 'jwe.jwe.jwe.vault1.user1'), -- direct access
('user2', '7E57C0DE-0000-4000-8000-000100001111', 'jwe.jwe.jwe.vault1.user2'), -- direct access
Expand Down

0 comments on commit f5a335d

Please sign in to comment.