Simplify database migrations
This commit is contained in:
parent
46d5b06bfc
commit
e6809c95db
106 changed files with 4661 additions and 6814 deletions
|
@ -3,30 +3,14 @@
|
|||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
|
||||
export default function updateToSchemaVersion79(
|
||||
currentVersion: number,
|
||||
db: Database,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 79) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
db.exec(`
|
||||
DROP INDEX messages_hasVisualMediaAttachments;
|
||||
CREATE INDEX messages_hasVisualMediaAttachments
|
||||
ON messages (
|
||||
conversationId, isStory, storyId,
|
||||
hasVisualMediaAttachments, received_at, sent_at
|
||||
)
|
||||
WHERE hasVisualMediaAttachments IS 1;
|
||||
`);
|
||||
|
||||
db.pragma('user_version = 79');
|
||||
})();
|
||||
|
||||
logger.info('updateToSchemaVersion79: success!');
|
||||
export default function updateToSchemaVersion79(db: Database): void {
|
||||
db.exec(`
|
||||
DROP INDEX messages_hasVisualMediaAttachments;
|
||||
CREATE INDEX messages_hasVisualMediaAttachments
|
||||
ON messages (
|
||||
conversationId, isStory, storyId,
|
||||
hasVisualMediaAttachments, received_at, sent_at
|
||||
)
|
||||
WHERE hasVisualMediaAttachments IS 1;
|
||||
`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue