Skip to content

Commit

Permalink
db migration added domain registration table
Browse files Browse the repository at this point in the history
  • Loading branch information
battermann committed Dec 6, 2024
1 parent 95dd773 commit ebeb81d
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 9 deletions.
39 changes: 31 additions & 8 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@ CREATE TABLE brig_test.mls_key_package_refs (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.excluded_phones (
prefix text PRIMARY KEY,
comment text
CREATE TABLE brig_test.oauth_client (
id uuid PRIMARY KEY,
name text,
redirect_uri blob,
secret blob
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
Expand Down Expand Up @@ -432,6 +434,24 @@ CREATE TABLE brig_test.user_keys (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.excluded_phones (
prefix text PRIMARY KEY,
comment text
) 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.mls_public_keys (
user uuid,
client text,
Expand Down Expand Up @@ -534,11 +554,14 @@ CREATE TABLE brig_test.federation_remote_teams (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.oauth_client (
id uuid PRIMARY KEY,
name text,
redirect_uri blob,
secret blob
CREATE TABLE brig_test.domain_registration (
domain ascii PRIMARY KEY,
backend_url blob,
dns_verification_token ascii,
domain_redirect int,
idp_id uuid,
team uuid,
team_invite int
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
Expand Down
1 change: 1 addition & 0 deletions services/brig/brig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ library
Brig.Schema.V85_DropUserKeysHashed
Brig.Schema.V86_WriteTimeBumper
Brig.Schema.V87_DropInvitationTables
Brig.Schema.V88_DomainRegistrationTable
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 @@ -62,6 +62,7 @@ import Brig.Schema.V84_DropTeamInvitationPhone qualified as V84_DropTeamInvitati
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 Brig.Schema.V88_DomainRegistrationTable qualified as V88_DomainRegistrationTable
import Cassandra.MigrateSchema (migrateSchema)
import Cassandra.Schema
import Control.Exception (finally)
Expand Down Expand Up @@ -130,7 +131,8 @@ migrations =
V84_DropTeamInvitationPhone.migration,
V85_DropUserKeysHashed.migration,
V86_WriteTimeBumper.migration,
V87_DropInvitationTables.migration
V87_DropInvitationTables.migration,
V88_DomainRegistrationTable.migration
-- FUTUREWORK: undo V41 (searchable flag); we stopped using it in
-- https://github.com/wireapp/wire-server/pull/964
]
43 changes: 43 additions & 0 deletions services/brig/src/Brig/Schema/V88_DomainRegistrationTable.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{-# LANGUAGE QuasiQuotes #-}

-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2023 Wire Swiss GmbH <[email protected]>
--
-- 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.V88_DomainRegistrationTable
( migration,
)
where

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

migration :: Migration
migration =
Migration 88 "Add domain_registration table" $ do
schema'
[r|
CREATE TABLE IF NOT EXISTS domain_registration
( domain ascii PRIMARY KEY,
, domain_redirect int,
, idp_id uuid,
, backend_url blob,
, team_invite int,
, team uuid
, dns_verification_token ascii
)
|]

0 comments on commit ebeb81d

Please sign in to comment.