state_stream.sql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Copyright 2016 OpenMarket 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. /* We used to create a table called current_state_resets, but this is no
  16. * longer used and is removed in delta 54.
  17. */
  18. /* The outlier events that have aquired a state group typically through
  19. * backfill. This is tracked separately to the events table, as assigning a
  20. * state group change the position of the existing event in the stream
  21. * ordering.
  22. * However since a stream_ordering is assigned in persist_event for the
  23. * (event, state) pair, we can use that stream_ordering to identify when
  24. * the new state was assigned for the event.
  25. */
  26. /* NB: This table belongs to the `main` logical database; it should not be present
  27. * in `state`.
  28. */
  29. CREATE TABLE IF NOT EXISTS ex_outlier_stream(
  30. event_stream_ordering BIGINT PRIMARY KEY NOT NULL,
  31. event_id TEXT NOT NULL,
  32. state_group BIGINT NOT NULL
  33. );