V1.1.5__jdbc-session.sql 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --
  2. -- Copyright 2022 Apollo Authors
  3. --
  4. -- Licensed under the Apache License, Version 2.0 (the "License");
  5. -- you may not use this file except in compliance with the License.
  6. -- You may obtain a copy of the License at
  7. --
  8. -- http://www.apache.org/licenses/LICENSE-2.0
  9. --
  10. -- Unless required by applicable law or agreed to in writing, software
  11. -- distributed under the License is distributed on an "AS IS" BASIS,
  12. -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. -- See the License for the specific language governing permissions and
  14. -- limitations under the License.
  15. --
  16. Use ApolloPortalDB;
  17. -- spring session (https://github.com/spring-projects/spring-session/blob/faee8f1bdb8822a5653a81eba838dddf224d92d6/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc/schema-mysql.sql)
  18. CREATE TABLE SPRING_SESSION (
  19. PRIMARY_ID CHAR(36) NOT NULL,
  20. SESSION_ID CHAR(36) NOT NULL,
  21. CREATION_TIME BIGINT NOT NULL,
  22. LAST_ACCESS_TIME BIGINT NOT NULL,
  23. MAX_INACTIVE_INTERVAL INT NOT NULL,
  24. EXPIRY_TIME BIGINT NOT NULL,
  25. PRINCIPAL_NAME VARCHAR(100),
  26. CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (PRIMARY_ID)
  27. ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
  28. CREATE UNIQUE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (SESSION_ID);
  29. CREATE INDEX SPRING_SESSION_IX2 ON SPRING_SESSION (EXPIRY_TIME);
  30. CREATE INDEX SPRING_SESSION_IX3 ON SPRING_SESSION (PRINCIPAL_NAME);
  31. CREATE TABLE SPRING_SESSION_ATTRIBUTES (
  32. SESSION_PRIMARY_ID CHAR(36) NOT NULL,
  33. ATTRIBUTE_NAME VARCHAR(200) NOT NULL,
  34. ATTRIBUTE_BYTES BLOB NOT NULL,
  35. CONSTRAINT SPRING_SESSION_ATTRIBUTES_PK PRIMARY KEY (SESSION_PRIMARY_ID, ATTRIBUTE_NAME),
  36. CONSTRAINT SPRING_SESSION_ATTRIBUTES_FK FOREIGN KEY (SESSION_PRIMARY_ID) REFERENCES SPRING_SESSION(PRIMARY_ID) ON DELETE CASCADE
  37. ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;