Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3174408
D8608.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8608.diff
View Options
diff --git a/keyserver/src/database/database.js b/keyserver/src/database/database.js
--- a/keyserver/src/database/database.js
+++ b/keyserver/src/database/database.js
@@ -14,6 +14,8 @@
const SQLStatement: SQLStatementType = SQL.SQLStatement;
const MYSQL_DUPLICATE_ENTRY_FOR_KEY_ERROR_CODE = 1062;
+const MYSQL_TABLE_DOESNT_EXIST_ERROR_CODE = 1146;
+const MYSQL_DEADLOCK_ERROR_CODE = 1213;
let migrationConnection;
async function getMigrationConnection() {
@@ -107,8 +109,6 @@
return result;
})();
-const MYSQL_DEADLOCK_ERROR_CODE = 1213;
-
type ConnectionContext = {
+migrationsActive?: boolean,
};
@@ -206,4 +206,5 @@
dbQuery,
rawSQL,
MYSQL_DUPLICATE_ENTRY_FOR_KEY_ERROR_CODE,
+ MYSQL_TABLE_DOESNT_EXIST_ERROR_CODE,
};
diff --git a/keyserver/src/database/migrations.js b/keyserver/src/database/migrations.js
--- a/keyserver/src/database/migrations.js
+++ b/keyserver/src/database/migrations.js
@@ -6,7 +6,12 @@
import { getMessageForException } from 'lib/utils/errors.js';
import sleep from 'lib/utils/sleep.js';
-import { dbQuery, SQL, setConnectionContext } from './database.js';
+import {
+ dbQuery,
+ SQL,
+ setConnectionContext,
+ MYSQL_TABLE_DOESNT_EXIST_ERROR_CODE,
+} from './database.js';
import { fetchDBVersion, updateDBVersion } from './db-version.js';
import { migrations } from './migration-config.js';
import { setupDB } from './setup-db.js';
@@ -50,8 +55,6 @@
return true;
}
-const MYSQL_TABLE_DOESNT_EXIST_ERROR_CODE = 1146;
-
async function setUpDBAndReturnVersion(): Promise<number> {
try {
return await fetchDBVersion();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 4:33 PM (8 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444587
Default Alt Text
D8608.diff (1 KB)
Attached To
Mode
D8608: [keyserver] Extract database error codes
Attached
Detach File
Event Timeline
Log In to Comment