Initial donationReceipts data types

This commit is contained in:
Scott Nonnenberg
2025-06-17 05:33:00 +10:00
committed by GitHub
parent 4347964030
commit 9ffee9d290
15 changed files with 472 additions and 5 deletions

View File

@@ -0,0 +1,35 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { LoggerType } from '../../types/Logging';
import type { WritableDB } from '../Interface';
export const version = 1380;
export function updateToSchemaVersion1380(
currentVersion: number,
db: WritableDB,
logger: LoggerType
): void {
if (currentVersion >= 1380) {
return;
}
db.transaction(() => {
db.exec(`
CREATE TABLE donationReceipts(
id TEXT NOT NULL PRIMARY KEY,
currencyType TEXT NOT NULL,
paymentAmount INTEGER NOT NULL,
paymentDetailJson TEXT NOT NULL,
paymentType TEXT NOT NULL,
timestamp INTEGER NOT NULL
) STRICT;
CREATE INDEX donationReceipts_byTimestamp on donationReceipts(timestamp);
`);
db.pragma('user_version = 1380');
})();
logger.info('updateToSchemaVersion1380: success!');
}

View File

@@ -112,10 +112,11 @@ import { updateToSchemaVersion1330 } from './1330-sync-tasks-type-index';
import { updateToSchemaVersion1340 } from './1340-recent-gifs';
import { updateToSchemaVersion1350 } from './1350-notification-profiles';
import { updateToSchemaVersion1360 } from './1360-attachments';
import { updateToSchemaVersion1370 } from './1370-message-attachment-indexes';
import {
updateToSchemaVersion1370,
updateToSchemaVersion1380,
version as MAX_VERSION,
} from './1370-message-attachment-indexes';
} from './1380-donation-receipts';
import { DataWriter } from '../Server';
@@ -2106,6 +2107,7 @@ export const SCHEMA_VERSIONS = [
updateToSchemaVersion1350,
updateToSchemaVersion1360,
updateToSchemaVersion1370,
updateToSchemaVersion1380,
];
export class DBVersionFromFutureError extends Error {