You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
1.1 KiB

  1. CREATE TABLE state_group_edges (
  2. state_group bigint NOT NULL,
  3. prev_state_group bigint NOT NULL
  4. );
  5. CREATE SEQUENCE state_group_id_seq
  6. START WITH 1
  7. INCREMENT BY 1
  8. NO MINVALUE
  9. NO MAXVALUE
  10. CACHE 1;
  11. CREATE TABLE state_groups (
  12. id bigint NOT NULL,
  13. room_id text NOT NULL,
  14. event_id text NOT NULL
  15. );
  16. CREATE TABLE state_groups_state (
  17. state_group bigint NOT NULL,
  18. room_id text NOT NULL,
  19. type text NOT NULL,
  20. state_key text NOT NULL,
  21. event_id text NOT NULL
  22. );
  23. ALTER TABLE ONLY state_groups_state ALTER COLUMN state_group SET (n_distinct=-0.02);
  24. ALTER TABLE ONLY state_groups
  25. ADD CONSTRAINT state_groups_pkey PRIMARY KEY (id);
  26. CREATE INDEX state_group_edges_prev_idx ON state_group_edges USING btree (prev_state_group);
  27. CREATE UNIQUE INDEX state_group_edges_unique_idx ON state_group_edges USING btree (state_group, prev_state_group);
  28. CREATE INDEX state_groups_room_id_idx ON state_groups USING btree (room_id);
  29. CREATE INDEX state_groups_state_type_idx ON state_groups_state USING btree (state_group, type, state_key);
  30. SELECT pg_catalog.setval('state_group_id_seq', 1, false);