Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/database/migration-config.js
Show First 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | async () => { | ||||
ALTER TABLE policy_acknowledgments | ALTER TABLE policy_acknowledgments | ||||
MODIFY user varchar(255) CHARSET latin1 COLLATE latin1_bin; | MODIFY user varchar(255) CHARSET latin1 COLLATE latin1_bin; | ||||
`, | `, | ||||
{ multipleStatements: true }, | { multipleStatements: true }, | ||||
); | ); | ||||
}, | }, | ||||
], | ], | ||||
[23, updateRolesAndPermissionsForAllThreads], | [23, updateRolesAndPermissionsForAllThreads], | ||||
[ | |||||
24, | |||||
async () => { | |||||
await dbQuery(SQL` | |||||
ALTER TABLE messages | |||||
ADD COLUMN IF NOT EXISTS pinned tinyint(1) UNSIGNED NOT NULL DEFAULT 0, | |||||
ADD COLUMN IF NOT EXISTS pin_time bigint(20) DEFAULT NULL, | |||||
ADD INDEX IF NOT EXISTS thread_pinned (thread, pinned); | |||||
`); | |||||
}, | |||||
], | |||||
]); | ]); | ||||
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 |