Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ INSERT INTO orgs (
i.created,
v.value as identity
FROM identities as i
LEFT JOIN verifiers v ON v.hash = REPLACE(hex(i.id),'-','') || REPLACE(hex(i.id),'-','')
LEFT JOIN verifiers pv ON pv.hash = REPLACE(hex(i.parent),'-','') || REPLACE(hex(i.parent),'-','')
LEFT JOIN verifiers v ON v.hash = REPLACE(i.id,'-','') || REPLACE(i.id,'-','')
LEFT JOIN verifiers pv ON pv.hash = REPLACE(i.parent,'-','') || REPLACE(i.parent,'-','')
WHERE i.did LIKE 'did:firefly:org/%' AND v.hash IS NOT NULL;

-- We only reconstitute nodes that were dropped during the original up migration.
Expand All @@ -76,8 +76,8 @@ INSERT INTO nodes (
i.created,
v.value as dx_peer
FROM identities as i
LEFT JOIN verifiers v ON v.hash = REPLACE(hex(i.id),'-','') || REPLACE(hex(i.id),'-','')
LEFT JOIN verifiers pv ON pv.hash = REPLACE(hex(i.parent),'-','') || REPLACE(hex(i.parent),'-','')
LEFT JOIN verifiers v ON v.hash = REPLACE(i.id,'-','') || REPLACE(i.id,'-','')
LEFT JOIN verifiers pv ON pv.hash = REPLACE(i.parent,'-','') || REPLACE(i.parent,'-','')
WHERE i.did LIKE 'did:firefly:node/%' AND v.hash IS NOT NULL;

DROP INDEX identities_id;
Expand Down
10 changes: 7 additions & 3 deletions db/migrations/sqlite/000063_create_identities_table.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ INSERT INTO identities (
did,
parent,
messages_claim,
itype,
namespace,
name,
description,
Expand All @@ -49,6 +50,7 @@ INSERT INTO identities (
'did:firefly:org/' || o1.name,
o2.id,
o1.message_id,
'org',
'ff_system',
o1.name,
o1.description,
Expand All @@ -63,6 +65,7 @@ INSERT INTO identities (
did,
parent,
messages_claim,
itype,
namespace,
name,
description,
Expand All @@ -74,6 +77,7 @@ INSERT INTO identities (
'did:firefly:node/' || n.name,
o.id,
n.message_id,
'node',
'ff_system',
n.name,
n.description,
Expand All @@ -91,7 +95,7 @@ INSERT INTO verifiers (
value,
created
) SELECT
REPLACE(hex(o.id), '-', '') || REPLACE(hex(o.id), '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
REPLACE(o.id, '-', '') || REPLACE(o.id, '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
'ff_system',
o.id,
'ethereum_address',
Expand All @@ -107,7 +111,7 @@ INSERT INTO verifiers (
value,
created
) SELECT
REPLACE(hex(o.id), '-', '') || REPLACE(hex(o.id), '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
REPLACE(o.id, '-', '') || REPLACE(o.id, '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
'ff_system',
o.id,
'fabric_msp_id',
Expand All @@ -123,7 +127,7 @@ INSERT INTO verifiers (
value,
created
) SELECT
REPLACE(hex(n.id), '-', '') || REPLACE(hex(n.id), '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
REPLACE(n.id, '-', '') || REPLACE(n.id, '-', ''), -- to avoid the need for hashing in the migration, use the convenient fact the UUID is known hex - have to write it twice to fill the 32B --
'ff_system',
n.id,
'dx_peer_id',
Expand Down