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
64 changes: 10 additions & 54 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,9 @@ CREATE TABLE brig_test.oauth_user_refresh_token (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.invitation_info (
code ascii PRIMARY KEY,
id uuid,
inviter uuid
CREATE TABLE brig_test.users_pending_activation (
user uuid PRIMARY KEY,
expires_at timestamp
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
Expand Down Expand Up @@ -867,24 +866,6 @@ CREATE TABLE brig_test.connection_remote (
AND speculative_retry = '99PERCENTILE';
CREATE INDEX connection_remote_right_domain_idx ON brig_test.connection_remote (right_domain);

CREATE TABLE brig_test.users_pending_activation (
user uuid PRIMARY KEY,
expires_at timestamp
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.connection (
left uuid,
right uuid,
Expand All @@ -910,27 +891,6 @@ CREATE TABLE brig_test.connection (
AND speculative_retry = '99PERCENTILE';
CREATE INDEX conn_status ON brig_test.connection (status);

CREATE TABLE brig_test.password_reset (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this one? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK the diff looks very confusing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason the order is not stable. but it's auto-generated and tested, so you don't need to read it.

key ascii PRIMARY KEY,
code ascii,
retries int,
timeout timestamp,
user uuid
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.federation_remotes (
domain text PRIMARY KEY,
restriction int,
Expand All @@ -950,20 +910,16 @@ CREATE TABLE brig_test.federation_remotes (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.invitation (
inviter uuid,
id uuid,
CREATE TABLE brig_test.password_reset (
key ascii PRIMARY KEY,
code ascii,
created_at timestamp,
email text,
name text,
phone text,
PRIMARY KEY (inviter, id)
) WITH CLUSTERING ORDER BY (id ASC)
AND bloom_filter_fp_chance = 0.01
retries int,
timeout timestamp,
user uuid
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/WPB-11101
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused invitation tables from brig.
1 change: 1 addition & 0 deletions services/brig/brig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ library
Brig.Schema.V84_DropTeamInvitationPhone
Brig.Schema.V85_DropUserKeysHashed
Brig.Schema.V86_WriteTimeBumper
Brig.Schema.V87_DropInvitationTables
Brig.Team.API
Brig.Team.Email
Brig.Team.Template
Expand Down
4 changes: 3 additions & 1 deletion services/brig/src/Brig/Schema/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import Brig.Schema.V83_AddTextStatus qualified as V83_AddTextStatus
import Brig.Schema.V84_DropTeamInvitationPhone qualified as V84_DropTeamInvitationPhone
import Brig.Schema.V85_DropUserKeysHashed qualified as V85_DropUserKeysHashed
import Brig.Schema.V86_WriteTimeBumper qualified as V86_WriteTimeBumper
import Brig.Schema.V87_DropInvitationTables qualified as V87_DropInvitationTables
import Cassandra.MigrateSchema (migrateSchema)
import Cassandra.Schema
import Control.Exception (finally)
Expand Down Expand Up @@ -128,7 +129,8 @@ migrations =
V83_AddTextStatus.migration,
V84_DropTeamInvitationPhone.migration,
V85_DropUserKeysHashed.migration,
V86_WriteTimeBumper.migration
V86_WriteTimeBumper.migration,
V87_DropInvitationTables.migration
-- FUTUREWORK: undo V41 (searchable flag); we stopped using it in
-- https://github.com/wireapp/wire-server/pull/964
]
35 changes: 35 additions & 0 deletions services/brig/src/Brig/Schema/V87_DropInvitationTables.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{-# LANGUAGE QuasiQuotes #-}

-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2023 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Brig.Schema.V87_DropInvitationTables
( migration,
)
where

import Cassandra.Schema
import Imports
import Text.RawString.QQ

migration :: Migration
migration =
Migration 87 "Drop unused invitation tables" $ do
schema'
[r| DROP TABLE IF EXISTS invitation |]
schema'
[r| DROP TABLE IF EXISTS invitation_info; |]