Change defaults for conversation title generation
This commit is contained in:
parent
6a165da589
commit
bd922433e3
14 changed files with 142 additions and 24 deletions
45
ts/sql/migrations/990-phone-number-sharing.ts
Normal file
45
ts/sql/migrations/990-phone-number-sharing.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from '@signalapp/better-sqlite3';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
|
||||
export const version = 990;
|
||||
|
||||
export function updateToSchemaVersion990(
|
||||
currentVersion: number,
|
||||
db: Database,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 990) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
db.exec(`
|
||||
UPDATE conversations
|
||||
SET json = json_remove(
|
||||
json_insert(
|
||||
json,
|
||||
'$.sharingPhoneNumber',
|
||||
iif(
|
||||
json ->> '$.notSharingPhoneNumber',
|
||||
-- We flip the value from false to true, and vice versa
|
||||
json('false'),
|
||||
json('true')
|
||||
)
|
||||
),
|
||||
'$.notSharingPhoneNumber'
|
||||
)
|
||||
-- Default value of '$.notSharingPhoneNumber' is true and
|
||||
-- the default value of '$.sharingPhoneNumber' is false so we don't have
|
||||
-- to do anything if the field wasn't present.
|
||||
WHERE json ->> '$.notSharingPhoneNumber' IS NOT NULL;
|
||||
`);
|
||||
})();
|
||||
|
||||
db.pragma('user_version = 990');
|
||||
|
||||
logger.info('updateToSchemaVersion990: success!');
|
||||
}
|
|
@ -73,10 +73,11 @@ import { updateToSchemaVersion940 } from './940-fts5-revert';
|
|||
import { updateToSchemaVersion950 } from './950-fts5-secure-delete';
|
||||
import { updateToSchemaVersion960 } from './960-untag-pni';
|
||||
import { updateToSchemaVersion970 } from './970-fts5-optimize';
|
||||
import { updateToSchemaVersion980 } from './980-reaction-timestamp';
|
||||
import {
|
||||
version as MAX_VERSION,
|
||||
updateToSchemaVersion980,
|
||||
} from './980-reaction-timestamp';
|
||||
updateToSchemaVersion990,
|
||||
} from './990-phone-number-sharing';
|
||||
|
||||
function updateToSchemaVersion1(
|
||||
currentVersion: number,
|
||||
|
@ -2017,6 +2018,7 @@ export const SCHEMA_VERSIONS = [
|
|||
updateToSchemaVersion960,
|
||||
updateToSchemaVersion970,
|
||||
updateToSchemaVersion980,
|
||||
updateToSchemaVersion990,
|
||||
];
|
||||
|
||||
export class DBVersionFromFutureError extends Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue