001_CreateCertificates.sql 1000 B

1234567891011121314151617181920212223242526272829
  1. -- +goose Up
  2. -- SQL in section 'Up' is executed when this migration is applied
  3. CREATE TABLE certificates (
  4. serial_number bytea NOT NULL,
  5. authority_key_identifier bytea NOT NULL,
  6. ca_label bytea,
  7. status bytea NOT NULL,
  8. reason int,
  9. expiry timestamptz,
  10. revoked_at timestamptz,
  11. pem bytea NOT NULL,
  12. PRIMARY KEY(serial_number, authority_key_identifier)
  13. );
  14. CREATE TABLE ocsp_responses (
  15. serial_number bytea NOT NULL,
  16. authority_key_identifier bytea NOT NULL,
  17. body bytea NOT NULL,
  18. expiry timestamptz,
  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;