Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
compat_access_tokens_session_fk
ON compat_access_tokens (compat_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
compat_refresh_tokens_session_fk
ON compat_refresh_tokens (compat_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
compat_refresh_tokens_access_token_fk
ON compat_refresh_tokens (compat_access_token_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

-- Including the `last_active_at` column lets us effeciently filter in-memory
-- for those sessions without fetching the rows, and without including it in the
-- index btree
CREATE INDEX CONCURRENTLY
compat_sessions_user_fk
ON compat_sessions (user_id)
INCLUDE (last_active_at);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
compat_sessions_user_session_fk
ON compat_sessions (user_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

-- Redundant with the `compat_sessions_user_fk`
DROP INDEX IF EXISTS compat_sessions_user_id_last_active_at;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
compat_sso_logins_session_fk
ON compat_sso_logins (compat_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_access_tokens_session_fk
ON oauth2_access_tokens (oauth2_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_authorization_grants_session_fk
ON oauth2_authorization_grants (oauth2_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_authorization_grants_client_fk
ON oauth2_authorization_grants (oauth2_client_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_consents_client_fk
ON oauth2_consents (oauth2_client_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_consents_user_fk
ON oauth2_consents (user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_device_code_grants_client_fk
ON oauth2_device_code_grant (oauth2_client_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_device_code_grants_session_fk
ON oauth2_device_code_grant (oauth2_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_device_code_grants_user_session_fk
ON oauth2_device_code_grant (user_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_refresh_tokens_session_fk
ON oauth2_refresh_tokens (oauth2_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_refresh_tokens_access_token_fk
ON oauth2_refresh_tokens (oauth2_access_token_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_refresh_tokens_next_refresh_token_fk
ON oauth2_refresh_tokens (next_oauth2_refresh_token_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_sessions_user_session_fk
ON oauth2_sessions (user_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
oauth2_sessions_client_fk
ON oauth2_sessions (oauth2_client_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

-- Including the `last_active_at` column lets us effeciently filter in-memory
-- for those sessions without fetching the rows, and without including it in the
-- index btree
CREATE INDEX CONCURRENTLY
oauth2_sessions_user_fk
ON oauth2_sessions (user_id)
INCLUDE (last_active_at);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

-- Redundant with the `oauth2_sessions_user_fk`
DROP INDEX IF EXISTS oauth2_sessions_user_id_last_active_at;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
queue_jobs_started_by_fk
ON queue_jobs (started_by);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
queue_jobs_next_attempt_fk
ON queue_jobs (next_attempt_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
queue_jobs_schedule_name_fk
ON queue_jobs (schedule_name);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
upstream_oauth_authorization_sessions_provider_fk
ON upstream_oauth_authorization_sessions (upstream_oauth_provider_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
upstream_oauth_authorization_sessions_link_fk
ON upstream_oauth_authorization_sessions (upstream_oauth_link_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
upstream_oauth_links_provider_fk
ON upstream_oauth_links (upstream_oauth_provider_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
upstream_oauth_links_user_fk
ON upstream_oauth_links (user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_email_authentication_codes_authentication_fk
ON user_email_authentication_codes (user_email_authentication_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_email_authentications_user_session_fk
ON user_email_authentications (user_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_email_authentications_user_registration_fk
ON user_email_authentications (user_registration_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_emails_user_fk
ON user_emails (user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

-- This isn't a foreign key, but we really need that to be indexed
CREATE INDEX CONCURRENTLY
user_emails_email_idx
ON user_emails (email);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_passwords_user_fk
ON user_passwords (user_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_recovery_tickets_session_fk
ON user_recovery_tickets (user_recovery_session_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_recovery_tickets_user_email_fk
ON user_recovery_tickets (user_email_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_registrations_email_authentication_fk
ON user_registrations (email_authentication_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.

CREATE INDEX CONCURRENTLY
user_session_authentications_user_session_fk
ON user_session_authentications (user_session_id);
Loading
Loading