Migrate schema to service ids

This commit is contained in:
Fedor Indutny 2023-08-16 22:54:39 +02:00 committed by Jamie Kyle
parent 71958f8a01
commit 8b0da36caa
258 changed files with 4795 additions and 2613 deletions

View file

@ -523,7 +523,7 @@ describe('sql/conversationSummary', () => {
details: [
{
type: 'member-remove',
uuid: ourAci,
aci: ourAci,
},
],
},
@ -541,7 +541,7 @@ describe('sql/conversationSummary', () => {
details: [
{
type: 'member-remove',
uuid: otherServiceId,
aci: otherServiceId,
},
],
},

View file

@ -261,18 +261,18 @@ describe('sql/searchMessages/withMentions', () => {
}
it('includes messages with mentions', async () => {
const mentionedUuids = [generateAci(), generateAci()];
const mentionedAcis = [generateAci(), generateAci()];
const messages = await storeMessages([
{
bodyRanges: [{ start: 0, length: 1, mentionUuid: mentionedUuids[0] }],
bodyRanges: [{ start: 0, length: 1, mentionAci: mentionedAcis[0] }],
},
{
bodyRanges: [{ start: 0, length: 1, mentionUuid: mentionedUuids[1] }],
bodyRanges: [{ start: 0, length: 1, mentionAci: mentionedAcis[1] }],
},
{
bodyRanges: [
{ start: 0, length: 1, mentionUuid: mentionedUuids[0] },
{ start: 1, length: 1, mentionUuid: mentionedUuids[1] },
{ start: 0, length: 1, mentionAci: mentionedAcis[0] },
{ start: 1, length: 1, mentionAci: mentionedAcis[1] },
],
},
{},
@ -280,7 +280,7 @@ describe('sql/searchMessages/withMentions', () => {
const searchResults = await searchMessages({
query: 'alice',
contactUuidsMatchingQuery: [mentionedUuids[0], generateAci()],
contactServiceIdsMatchingQuery: [mentionedAcis[0], generateAci()],
});
assert.sameOrderedMembers(
@ -290,7 +290,7 @@ describe('sql/searchMessages/withMentions', () => {
const searchResultsForMultipleMatchingUuids = await searchMessages({
query: 'alice',
contactUuidsMatchingQuery: [mentionedUuids[0], mentionedUuids[1]],
contactServiceIdsMatchingQuery: [mentionedAcis[0], mentionedAcis[1]],
});
assert.sameOrderedMembers(
@ -301,7 +301,7 @@ describe('sql/searchMessages/withMentions', () => {
});
it('includes messages with mentions and those that match the body text', async () => {
const mentionedUuids = [generateAci(), generateAci()];
const mentionedAcis = [generateAci(), generateAci()];
const messages = await storeMessages([
{
body: 'cat',
@ -309,8 +309,8 @@ describe('sql/searchMessages/withMentions', () => {
{
body: 'dog',
bodyRanges: [
{ start: 0, length: 1, mentionUuid: mentionedUuids[0] },
{ start: 1, length: 1, mentionUuid: mentionedUuids[1] },
{ start: 0, length: 1, mentionAci: mentionedAcis[0] },
{ start: 1, length: 1, mentionAci: mentionedAcis[1] },
],
},
{
@ -320,7 +320,7 @@ describe('sql/searchMessages/withMentions', () => {
const searchResults = await searchMessages({
query: 'cat',
contactUuidsMatchingQuery: [mentionedUuids[0], generateAci()],
contactServiceIdsMatchingQuery: [mentionedAcis[0], generateAci()],
});
assert.sameOrderedMembers(
@ -332,7 +332,7 @@ describe('sql/searchMessages/withMentions', () => {
// match the mention or the text
const searchResultsForDog = await searchMessages({
query: 'dog',
contactUuidsMatchingQuery: [mentionedUuids[1], generateAci()],
contactServiceIdsMatchingQuery: [mentionedAcis[1], generateAci()],
});
assert.sameOrderedMembers(
searchResultsForDog.map(res => res.id),
@ -340,7 +340,7 @@ describe('sql/searchMessages/withMentions', () => {
);
});
it('respects conversationId for mention matches', async () => {
const mentionedUuids = [generateAci(), generateAci()];
const mentionedAcis = [generateAci(), generateAci()];
const conversationId = generateUuid();
const messages = await storeMessages([
{
@ -349,12 +349,12 @@ describe('sql/searchMessages/withMentions', () => {
},
{
body: 'dog',
bodyRanges: [{ start: 0, length: 1, mentionUuid: mentionedUuids[0] }],
bodyRanges: [{ start: 0, length: 1, mentionAci: mentionedAcis[0] }],
conversationId,
},
{
body: 'dog',
bodyRanges: [{ start: 0, length: 1, mentionUuid: mentionedUuids[0] }],
bodyRanges: [{ start: 0, length: 1, mentionAci: mentionedAcis[0] }],
},
{
body: 'cat',
@ -363,7 +363,7 @@ describe('sql/searchMessages/withMentions', () => {
const searchResults = await searchMessages({
query: 'cat',
contactUuidsMatchingQuery: [mentionedUuids[0]],
contactServiceIdsMatchingQuery: [mentionedAcis[0]],
conversationId,
});
@ -374,7 +374,7 @@ describe('sql/searchMessages/withMentions', () => {
const searchResultsWithoutConversationid = await searchMessages({
query: 'cat',
contactUuidsMatchingQuery: [mentionedUuids[0]],
contactServiceIdsMatchingQuery: [mentionedAcis[0]],
});
assert.sameOrderedMembers(

View file

@ -54,7 +54,7 @@ describe('sql/getCallHistoryGroups', () => {
return {
callId,
peerId: conversationId,
ringerId: conversationId,
ringerId: generateAci(),
mode: CallMode.Direct,
type: CallType.Video,
direction: CallDirection.Incoming,
@ -85,7 +85,7 @@ describe('sql/getCallHistoryGroups', () => {
return {
callId,
peerId: conversationId,
ringerId: conversationId,
ringerId: generateAci(),
mode: CallMode.Direct,
type,
direction: CallDirection.Incoming,
@ -116,7 +116,7 @@ describe('sql/getCallHistoryGroups', () => {
return {
callId,
peerId: conversationId,
ringerId: conversationId,
ringerId: generateAci(),
mode: CallMode.Direct,
type,
direction: CallDirection.Incoming,
@ -157,7 +157,7 @@ describe('sql/getCallHistoryGroups', () => {
type: 'private',
version: 0,
id: 'id:1',
uuid: conversation1Uuid,
serviceId: conversation1Uuid,
};
const conversation2: ConversationAttributesType = {

View file

@ -526,7 +526,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message1.id,
messageReceivedAt: message1.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction2: ReactionType = {
@ -535,7 +535,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message2.id,
messageReceivedAt: message2.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction3: ReactionType = {
@ -544,7 +544,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message3.id,
messageReceivedAt: message3.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction4: ReactionType = {
@ -553,7 +553,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message4.id,
messageReceivedAt: message4.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction5: ReactionType = {
@ -562,7 +562,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message5.id,
messageReceivedAt: message5.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
@ -675,7 +675,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message1.id,
messageReceivedAt: message1.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction2: ReactionType = {
@ -684,7 +684,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message2.id,
messageReceivedAt: message2.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction3: ReactionType = {
@ -693,7 +693,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message3.id,
messageReceivedAt: message3.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction4: ReactionType = {
@ -702,7 +702,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message4.id,
messageReceivedAt: message4.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};
const reaction5: ReactionType = {
@ -711,7 +711,7 @@ describe('sql/markRead', () => {
fromId: generateUuid(),
messageId: message5.id,
messageReceivedAt: message5.received_at,
targetAuthorUuid: generateAci(),
targetAuthorAci: generateAci(),
targetTimestamp: start,
};

View file

@ -23,7 +23,7 @@ describe('sql/stories', () => {
const now = Date.now();
const conversationId = generateUuid();
const sourceUuid = generateAci();
const sourceServiceId = generateAci();
const ourAci = generateAci();
const story1: MessageAttributesType = {
@ -34,7 +34,7 @@ describe('sql/stories', () => {
sent_at: now - 20,
received_at: now - 20,
timestamp: now - 20,
sourceUuid: generateAci(),
sourceServiceId: generateAci(),
};
const story2: MessageAttributesType = {
id: generateUuid(),
@ -44,7 +44,7 @@ describe('sql/stories', () => {
sent_at: now - 10,
received_at: now - 10,
timestamp: now - 10,
sourceUuid,
sourceServiceId,
};
const story3: MessageAttributesType = {
id: generateUuid(),
@ -54,7 +54,7 @@ describe('sql/stories', () => {
sent_at: now,
received_at: now,
timestamp: now,
sourceUuid,
sourceServiceId,
};
const story4: MessageAttributesType = {
id: generateUuid(),
@ -64,7 +64,7 @@ describe('sql/stories', () => {
sent_at: now,
received_at: now,
timestamp: now,
sourceUuid: generateAci(),
sourceServiceId: generateAci(),
};
const story5: MessageAttributesType = {
id: generateUuid(),
@ -74,7 +74,7 @@ describe('sql/stories', () => {
sent_at: now,
received_at: now,
timestamp: now,
sourceUuid,
sourceServiceId,
};
await saveMessages([story1, story2, story3, story4, story5], {
@ -121,7 +121,7 @@ describe('sql/stories', () => {
);
const storiesByAuthor = await getAllStories({
sourceUuid,
sourceServiceId,
});
assert.lengthOf(storiesByAuthor, 2, 'expect two stories by author');

View file

@ -97,7 +97,7 @@ describe('sql/storyDistribution', () => {
memberDevices: [
{
id: 1,
identifier: SERVICE_ID_1,
serviceId: SERVICE_ID_1,
registrationId: 232,
},
],