Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/database/migration-config.js
Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | const migrations: $ReadOnlyMap<number, () => Promise<void>> = new Map([ | ||||
[ | [ | ||||
14, | 14, | ||||
async () => { | async () => { | ||||
await dbQuery(SQL` | await dbQuery(SQL` | ||||
ALTER TABLE cookies MODIFY COLUMN social_proof mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; | ALTER TABLE cookies MODIFY COLUMN social_proof mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; | ||||
`); | `); | ||||
}, | }, | ||||
], | ], | ||||
[ | |||||
15, | |||||
async () => { | |||||
await dbQuery( | |||||
SQL`ALTER TABLE cookies | |||||
ashoat: Can you format the JS the same as other queries in the file? | |||||
DROP INDEX device_token, | |||||
DROP INDEX user_device_token; | |||||
ALTER TABLE cookies | |||||
MODIFY device_token mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, | |||||
ashoatUnsubmitted Not Done Inline ActionsThe migration above this breaks this rule, but we should stay within 80 chars ashoat: The migration above this breaks this rule, but we should stay within 80 chars | |||||
ashoatUnsubmitted Not Done Inline ActionsDid you verify that the text is preserved when running this migration? ashoat: Did you verify that the text is preserved when running this migration? | |||||
ADD UNIQUE KEY device_token (device_token(512)), | |||||
ADD KEY user_device_token (user,device_token(512));`, | |||||
{ multipleStatements: true }, | |||||
); | |||||
}, | |||||
], | |||||
]); | ]); | ||||
const newDatabaseVersion: number = Math.max(...migrations.keys()); | const newDatabaseVersion: number = Math.max(...migrations.keys()); | ||||
async function writeJSONToFile(data: any, filePath: string): Promise<void> { | async function writeJSONToFile(data: any, filePath: string): Promise<void> { | ||||
console.warn(`updating ${filePath} to ${JSON.stringify(data)}`); | console.warn(`updating ${filePath} to ${JSON.stringify(data)}`); | ||||
const fileHandle = await fs.promises.open(filePath, 'w'); | const fileHandle = await fs.promises.open(filePath, 'w'); | ||||
await fileHandle.writeFile(JSON.stringify(data, null, ' '), 'utf8'); | await fileHandle.writeFile(JSON.stringify(data, null, ' '), 'utf8'); | ||||
await fileHandle.close(); | await fileHandle.close(); | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |
Can you format the JS the same as other queries in the file?