Drop deprecated SQL columns
This commit is contained in:
parent
54aa0d39b9
commit
c286e0f9c6
2 changed files with 33 additions and 1 deletions
31
ts/sql/migrations/68-drop-deprecated-columns.ts
Normal file
31
ts/sql/migrations/68-drop-deprecated-columns.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from 'better-sqlite3';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
|
||||
export default function updateToSchemaVersion68(
|
||||
currentVersion: number,
|
||||
db: Database,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 68) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
db.exec(
|
||||
`
|
||||
ALTER TABLE messages
|
||||
DROP COLUMN deprecatedSourceDevice;
|
||||
ALTER TABLE unprocessed
|
||||
DROP COLUMN deprecatedSourceDevice;
|
||||
`
|
||||
);
|
||||
|
||||
db.pragma('user_version = 68');
|
||||
})();
|
||||
|
||||
logger.info('updateToSchemaVersion68: success!');
|
||||
}
|
|
@ -43,6 +43,7 @@ import updateToSchemaVersion64 from './64-uuid-column-for-pre-keys';
|
|||
import updateToSchemaVersion65 from './65-add-storage-id-to-stickers';
|
||||
import updateToSchemaVersion66 from './66-add-pni-signature-to-sent-protos';
|
||||
import updateToSchemaVersion67 from './67-add-story-to-unprocessed';
|
||||
import updateToSchemaVersion68 from './68-drop-deprecated-columns';
|
||||
|
||||
function updateToSchemaVersion1(
|
||||
currentVersion: number,
|
||||
|
@ -1809,7 +1810,6 @@ function updateToSchemaVersion38(
|
|||
}
|
||||
|
||||
db.transaction(() => {
|
||||
// TODO: Remove deprecated columns once sqlcipher is updated to support it
|
||||
db.exec(`
|
||||
DROP INDEX IF EXISTS messages_duplicate_check;
|
||||
|
||||
|
@ -1949,6 +1949,7 @@ export const SCHEMA_VERSIONS = [
|
|||
updateToSchemaVersion65,
|
||||
updateToSchemaVersion66,
|
||||
updateToSchemaVersion67,
|
||||
updateToSchemaVersion68,
|
||||
];
|
||||
|
||||
export function updateSchema(db: Database, logger: LoggerType): void {
|
||||
|
|
Loading…
Add table
Reference in a new issue