From 9915a78c7e441f94c7e2fb2705f8810ef150cf5c Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 24 Nov 2021 09:37:35 +0100 Subject: [PATCH] Creation script and deletion script. --- database/migrations/0005-admin_tables.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 database/migrations/0005-admin_tables.ts diff --git a/database/migrations/0005-admin_tables.ts b/database/migrations/0005-admin_tables.ts new file mode 100644 index 000000000..3730755f0 --- /dev/null +++ b/database/migrations/0005-admin_tables.ts @@ -0,0 +1,24 @@ +/* MIGRATION FOR ADMIN INTERFACE + */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn(` + CREATE TABLE \`login_pending_tasks_admin\` ( + \`id\` int UNSIGNED NOT NULL AUTO_INCREMENT, + \`user_id\` int UNSIGNED DEFAULT 0, + \`request\` varbinary(2048) NOT NULL, + \`created\` datetime NOT NULL, + \`finished\` datetime DEFAULT '2000-01-01 000000', + \`result_json\` text DEFAULT NULL, + \`param_json\` text DEFAULT NULL, + \`task_type_id\` int UNSIGNED NOT NULL, + \`child_pending_task_id\` int UNSIGNED DEFAULT 0, + \`parent_pending_task_id\` int UNSIGNED DEFAULT 0, + PRIMARY KEY (\`id\`) + ) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4; + `) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn(`DROP TABLE \`login_pending_tasks_admin\`;`) +}