Page MenuHomePhabricator

D13209.id43951.diff
No OneTemporary

D13209.id43951.diff

diff --git a/keyserver/src/database/migration-config.js b/keyserver/src/database/migration-config.js
--- a/keyserver/src/database/migration-config.js
+++ b/keyserver/src/database/migration-config.js
@@ -38,9 +38,13 @@
const botViewer = createScriptViewer(bots.commbot.userID);
+export type MigrationType =
+ | 'wrap_in_transaction_and_block_requests'
+ | 'run_simultaneously_with_requests';
export type Migration = {
+version: number,
+migrationPromise: () => Promise<mixed>,
+ +migrationType?: MigrationType,
};
const migrations: $ReadOnlyArray<Migration> = [
@@ -50,6 +54,7 @@
await makeSureBaseRoutePathExists('facts/commapp_url.json');
await makeSureBaseRoutePathExists('facts/squadcal_url.json');
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 1,
@@ -58,6 +63,7 @@
await fs.promises.unlink('facts/url.json');
} catch {}
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 2,
@@ -65,17 +71,20 @@
await fixBaseRoutePathForLocalhost('facts/commapp_url.json');
await fixBaseRoutePathForLocalhost('facts/squadcal_url.json');
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 3,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 4,
migrationPromise: async () => {
await dbQuery(SQL`ALTER TABLE uploads ADD INDEX container (container)`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 5,
@@ -87,6 +96,7 @@
ADD social_proof varchar(255) DEFAULT NULL;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 7,
@@ -103,6 +113,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 8,
@@ -114,6 +125,7 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 9,
@@ -129,6 +141,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 10,
@@ -143,6 +156,7 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 11,
@@ -155,6 +169,7 @@
FROM users
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 12,
@@ -167,6 +182,7 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 13,
@@ -177,6 +193,7 @@
moveToNonApacheConfig('facts/landing_url.json', '/commlanding/'),
]);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 14,
@@ -185,6 +202,7 @@
ALTER TABLE cookies MODIFY COLUMN social_proof mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 15,
@@ -204,6 +222,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 16,
@@ -222,6 +241,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 17,
@@ -241,12 +261,18 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 18,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
+ },
+ {
+ version: 19,
+ migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
- { version: 19, migrationPromise: updateRolesAndPermissionsForAllThreads },
{
version: 20,
migrationPromise: async () => {
@@ -257,6 +283,7 @@
DEFAULT NULL;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 21,
@@ -268,6 +295,7 @@
(user, type, platform, creation_time);
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 22,
@@ -316,14 +344,17 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 23,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 24,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 25,
@@ -343,10 +374,12 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 26,
migrationPromise: processMessagesInDBForSearch,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 27,
@@ -358,6 +391,7 @@
ADD INDEX IF NOT EXISTS thread_pinned (thread, pinned);
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 28,
@@ -367,16 +401,19 @@
ADD COLUMN IF NOT EXISTS pinned_count int UNSIGNED NOT NULL DEFAULT 0;
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 29,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 30,
migrationPromise: async () => {
await dbQuery(SQL`DROP TABLE versions;`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 31,
@@ -401,6 +438,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 32,
@@ -411,6 +449,7 @@
WHERE type = ${messageTypes.SIDEBAR_SOURCE};
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 33,
@@ -432,6 +471,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 34,
@@ -455,16 +495,19 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 35,
migrationPromise: async () => {
await createOlmAccounts();
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 36,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 37,
@@ -478,6 +521,7 @@
);
await createOlmAccounts();
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 38,
@@ -513,10 +557,12 @@
);
}
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 39,
migrationPromise: ensureUserCredentials,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 40,
@@ -528,6 +574,7 @@
MODIFY COLUMN data VARCHAR(1023)
`,
),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 41,
@@ -539,6 +586,7 @@
ADD KEY user_role_thread (user, role, thread)
`,
),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 42,
@@ -548,6 +596,7 @@
ADD UNIQUE KEY thread_name (thread, name);
`);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 43,
@@ -563,6 +612,7 @@
)
`,
),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 44,
@@ -587,6 +637,7 @@
),
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 45,
@@ -605,6 +656,7 @@
CHARSET latin1 COLLATE latin1_swedish_ci NOT NULL;
`,
),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 46,
@@ -622,11 +674,13 @@
}
}
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 47,
migrationPromise: () =>
dbQuery(SQL`ALTER TABLE cookies MODIFY COLUMN hash char(64) NOT NULL`),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 48,
@@ -659,6 +713,7 @@
`;
await dbQuery(query);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 49,
@@ -671,6 +726,7 @@
};
await writeJSONToFile(defaultCorsConfig, 'facts/webapp_cors.json');
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 50,
@@ -678,6 +734,7 @@
await moveToNonApacheConfig('facts/webapp_url.json', '/webapp/');
await moveToNonApacheConfig('facts/keyserver_url.json', '/keyserver/');
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 51,
@@ -706,6 +763,7 @@
await dbQuery(updateQuery);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 52,
@@ -720,6 +778,7 @@
await updateRolesAndPermissionsForAllThreads();
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 53,
@@ -728,6 +787,7 @@
ALTER TABLE invite_links
ADD COLUMN blob_holder char(36) CHARSET latin1
`),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 54,
@@ -747,6 +807,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 55,
@@ -758,6 +819,7 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 56,
@@ -770,10 +832,12 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 57,
migrationPromise: synchronizeInviteLinksWithBlobs,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 58,
@@ -785,10 +849,12 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 59,
migrationPromise: () => dbQuery(SQL`DROP TABLE one_time_keys`),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 60,
@@ -802,6 +868,7 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 61,
@@ -813,6 +880,7 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 62,
@@ -824,6 +892,7 @@
`,
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 63,
@@ -844,6 +913,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 64,
@@ -867,6 +937,7 @@
{ multipleStatements: true },
);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 65,
@@ -877,18 +948,22 @@
ADD COLUMN IF NOT EXISTS thread_role bigint(20) DEFAULT NULL,
ADD INDEX IF NOT EXISTS community_thread (community, thread);
`),
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 66,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 67,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 68,
migrationPromise: updateRolesAndPermissionsForAllThreads,
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 69,
@@ -944,6 +1019,7 @@
await updateRolesAndPermissionsForAllThreads();
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
{
version: 70,
@@ -974,6 +1050,7 @@
const relationshipRows = relationshipChangeset.getRows();
await updateChangedUndirectedRelationships(relationshipRows);
},
+ migrationType: 'wrap_in_transaction_and_block_requests',
},
];
const versions: $ReadOnlyArray<number> = migrations.map(

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 5:51 AM (1 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2730877
Default Alt Text
D13209.id43951.diff (12 KB)

Event Timeline