mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
24 lines
905 B
TypeScript
24 lines
905 B
TypeScript
/* MIGRATION TO ADD USER SETTINGS
|
|
*
|
|
* This migration adds the table `user_setting` in order to store all sorts of user configuration data
|
|
*/
|
|
|
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
|
await queryFn(`
|
|
CREATE TABLE IF NOT EXISTS \`user_setting\` (
|
|
\`id\` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
\`userId\` int(11) NOT NULL,
|
|
\`key\` varchar(255) NOT NULL,
|
|
\`value\` varchar(255) NOT NULL,
|
|
PRIMARY KEY (\`id\`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`)
|
|
}
|
|
|
|
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
|
// write downgrade logic as parameter of queryFn
|
|
await queryFn(`DROP TABLE IF EXISTS \`user_setting\`;`)
|
|
}
|