From b83af135a89e988a2e36710be656f5b429de6092 Mon Sep 17 00:00:00 2001 From: brontolosone <177225737+brontolosone@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:07:33 +0000 Subject: [PATCH] add index on sessions(token); fixes #1201 --- .../20241001-01-index-on-session-table.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/model/migrations/20241001-01-index-on-session-table.js diff --git a/lib/model/migrations/20241001-01-index-on-session-table.js b/lib/model/migrations/20241001-01-index-on-session-table.js new file mode 100644 index 000000000..d1b8f00a4 --- /dev/null +++ b/lib/model/migrations/20241001-01-index-on-session-table.js @@ -0,0 +1,18 @@ +// Copyright 2024 ODK Central Developers +// See the NOTICE file at the top-level directory of this distribution and at +// https://github.com/getodk/central-backend/blob/master/NOTICE. +// This file is part of ODK Central. It is subject to the license terms in +// the LICENSE file found in the top-level directory of this distribution and at +// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, +// including this file, may be copied, modified, propagated, or distributed +// except according to the terms contained in the LICENSE file. + +const up = (db) => db.raw(` + CREATE UNIQUE INDEX "sessions_token_index" ON sessions (token); +`); + +const down = (db) => db.raw(` + DROP INDEX "sessions_token_index"; +`); + +module.exports = { up, down };