Fix sourceDevice column type in unprocessed
This commit is contained in:
parent
649d24b623
commit
96718464ef
4 changed files with 119 additions and 5 deletions
34
ts/sql/migrations/1290-int-unprocessed-source-device.ts
Normal file
34
ts/sql/migrations/1290-int-unprocessed-source-device.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
import { sql } from '../util';
|
||||
import type { WritableDB } from '../Interface';
|
||||
|
||||
export const version = 1290;
|
||||
|
||||
export function updateToSchemaVersion1290(
|
||||
currentVersion: number,
|
||||
db: WritableDB,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 1290) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
const [query] = sql`
|
||||
ALTER TABLE unprocessed RENAME COLUMN sourceDevice TO legacySourceDevice;
|
||||
ALTER TABLE unprocessed ADD COLUMN sourceDevice INTEGER;
|
||||
|
||||
UPDATE unprocessed
|
||||
SET sourceDevice = legacySourceDevice;
|
||||
|
||||
ALTER TABLE unprocessed DROP COLUMN legacySourceDevice;
|
||||
`;
|
||||
db.exec(query);
|
||||
|
||||
db.pragma('user_version = 1290');
|
||||
})();
|
||||
|
||||
logger.info('updateToSchemaVersion1290: success!');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue