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