invite_tokens.sql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Copyright 2015 OpenMarket Ltd
  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. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. CREATE TABLE IF NOT EXISTS invite_tokens (
  14. id integer primary key,
  15. medium varchar(16) not null,
  16. address varchar(256) not null,
  17. room_id varchar(256) not null,
  18. sender varchar(256) not null,
  19. token varchar(256) not null,
  20. received_ts bigint, -- When the invite was received by us from the homeserver
  21. sent_ts bigint -- When the token was sent by us to the user
  22. );
  23. CREATE INDEX IF NOT EXISTS invite_token_medium_address on invite_tokens(medium, address);
  24. CREATE INDEX IF NOT EXISTS invite_token_token on invite_tokens(token);
  25. CREATE TABLE IF NOT EXISTS ephemeral_public_keys(
  26. id integer primary key,
  27. public_key varchar(256) not null,
  28. verify_count bigint default 0,
  29. persistence_ts bigint
  30. );
  31. CREATE UNIQUE INDEX IF NOT EXISTS ephemeral_public_keys_index on ephemeral_public_keys(public_key);