001_CreateCertificates.sql 988 B

12345678910111213141516171819202122232425262728293031
  1. -- +goose Up
  2. -- SQL in section 'Up' is executed when this migration is applied
  3. CREATE TABLE certificates (
  4. serial_number blob NOT NULL,
  5. authority_key_identifier blob NOT NULL,
  6. ca_label blob,
  7. status blob NOT NULL,
  8. reason int,
  9. expiry timestamp,
  10. revoked_at timestamp,
  11. pem blob NOT NULL,
  12. PRIMARY KEY(serial_number, authority_key_identifier)
  13. );
  14. CREATE TABLE ocsp_responses (
  15. serial_number blob NOT NULL,
  16. authority_key_identifier blob NOT NULL,
  17. body blob NOT NULL,
  18. expiry timestamp,
  19. PRIMARY KEY(serial_number, authority_key_identifier),
  20. FOREIGN KEY(serial_number, authority_key_identifier) REFERENCES certificates(serial_number, authority_key_identifier)
  21. );
  22. -- +goose Down
  23. -- SQL section 'Down' is executed when this migration is rolled back
  24. DROP TABLE ocsp_responses;
  25. DROP TABLE certificates;