1/* Copyright 2019 New Vector Ltd
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *    http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16-- We previously changed the schema for this table without renaming the file, which means
17-- that some databases might still be using the old schema. This ensures Synapse uses the
18-- right schema for the table.
19DROP TABLE IF EXISTS account_validity;
20
21-- Track what users are in public rooms.
22CREATE TABLE IF NOT EXISTS account_validity (
23    user_id TEXT PRIMARY KEY,
24    expiration_ts_ms BIGINT NOT NULL,
25    email_sent BOOLEAN NOT NULL,
26    renewal_token TEXT
27);
28
29CREATE INDEX account_validity_email_sent_idx ON account_validity(email_sent, expiration_ts_ms)
30CREATE UNIQUE INDEX account_validity_renewal_string_idx ON account_validity(renewal_token)
31