2024-02-07 21:38:43 +00:00
|
|
|
// Copyright 2023 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
|
|
|
|
2024-07-22 18:16:33 +00:00
|
|
|
import type { WritableDB } from '../../sql/Interface';
|
|
|
|
import { createDB, updateToVersion, insertData, getTableData } from './helpers';
|
2024-02-07 21:38:43 +00:00
|
|
|
|
|
|
|
describe('SQL/updateToSchemaVersion990', () => {
|
2024-07-22 18:16:33 +00:00
|
|
|
let db: WritableDB;
|
2024-02-07 21:38:43 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2024-07-22 18:16:33 +00:00
|
|
|
db = createDB();
|
2024-02-07 21:38:43 +00:00
|
|
|
updateToVersion(db, 980);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
db.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should migrate conversations', () => {
|
|
|
|
insertData(db, 'conversations', [
|
|
|
|
{
|
|
|
|
id: 'no-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'false-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
notSharingPhoneNumber: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'true-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
notSharingPhoneNumber: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
updateToVersion(db, 990);
|
|
|
|
assert.deepStrictEqual(getTableData(db, 'conversations'), [
|
|
|
|
{
|
|
|
|
id: 'no-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'false-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
sharingPhoneNumber: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'true-prop',
|
|
|
|
json: {
|
|
|
|
keep: 'this',
|
|
|
|
sharingPhoneNumber: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|