Debian Codegraph @

ent/migrate/migrations/pgsql/20240524112615_pgsql.sql

raw
1 -- Create "statements" table
2 CREATE TABLE "statements" ("id" uuid NOT NULL, "predicate" character varying NOT NULL, PRIMARY KEY ("id"));
3 -- Create index "statement_predicate" to table: "statements"
4 CREATE INDEX "statement_predicate" ON "statements" ("predicate");
5 -- Create "attestation_collections" table
6 CREATE TABLE "attestation_collections" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_attestation_collections" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "attestation_collections_statements_attestation_collections" FOREIGN KEY ("statement_attestation_collections") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION);
7 -- Create index "attestation_collections_statement_attestation_collections_key" to table: "attestation_collections"
8 CREATE UNIQUE INDEX "attestation_collections_statement_attestation_collections_key" ON "attestation_collections" ("statement_attestation_collections");
9 -- Create index "attestationcollection_name" to table: "attestation_collections"
10 CREATE INDEX "attestationcollection_name" ON "attestation_collections" ("name");
11 -- Create "attestation_policies" table
12 CREATE TABLE "attestation_policies" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_policy" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "attestation_policies_statements_policy" FOREIGN KEY ("statement_policy") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
13 -- Create index "attestation_policies_statement_policy_key" to table: "attestation_policies"
14 CREATE UNIQUE INDEX "attestation_policies_statement_policy_key" ON "attestation_policies" ("statement_policy");
15 -- Create index "attestationpolicy_name" to table: "attestation_policies"
16 CREATE INDEX "attestationpolicy_name" ON "attestation_policies" ("name");
17 -- Create "attestations" table
18 CREATE TABLE "attestations" ("id" uuid NOT NULL, "type" character varying NOT NULL, "attestation_collection_attestations" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "attestations_attestation_collections_attestations" FOREIGN KEY ("attestation_collection_attestations") REFERENCES "attestation_collections" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION);
19 -- Create index "attestation_type" to table: "attestations"
20 CREATE INDEX "attestation_type" ON "attestations" ("type");
21 -- Create "dsses" table
22 CREATE TABLE "dsses" ("id" uuid NOT NULL, "gitoid_sha256" character varying NOT NULL, "payload_type" character varying NOT NULL, "dsse_statement" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "dsses_statements_statement" FOREIGN KEY ("dsse_statement") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
23 -- Create index "dsses_gitoid_sha256_key" to table: "dsses"
24 CREATE UNIQUE INDEX "dsses_gitoid_sha256_key" ON "dsses" ("gitoid_sha256");
25 -- Create "payload_digests" table
26 CREATE TABLE "payload_digests" ("id" uuid NOT NULL, "algorithm" character varying NOT NULL, "value" character varying NOT NULL, "dsse_payload_digests" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "payload_digests_dsses_payload_digests" FOREIGN KEY ("dsse_payload_digests") REFERENCES "dsses" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
27 -- Create index "payloaddigest_value" to table: "payload_digests"
28 CREATE INDEX "payloaddigest_value" ON "payload_digests" ("value");
29 -- Create "signatures" table
30 CREATE TABLE "signatures" ("id" uuid NOT NULL, "key_id" character varying NOT NULL, "signature" character varying NOT NULL, "dsse_signatures" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "signatures_dsses_signatures" FOREIGN KEY ("dsse_signatures") REFERENCES "dsses" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
31 -- Create index "signature_key_id" to table: "signatures"
32 CREATE INDEX "signature_key_id" ON "signatures" ("key_id");
33 -- Create "subjects" table
34 CREATE TABLE "subjects" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_subjects" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "subjects_statements_subjects" FOREIGN KEY ("statement_subjects") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
35 -- Create index "subject_name" to table: "subjects"
36 CREATE INDEX "subject_name" ON "subjects" ("name");
37 -- Create "subject_digests" table
38 CREATE TABLE "subject_digests" ("id" uuid NOT NULL, "algorithm" character varying NOT NULL, "value" character varying NOT NULL, "subject_subject_digests" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "subject_digests_subjects_subject_digests" FOREIGN KEY ("subject_subject_digests") REFERENCES "subjects" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);
39 -- Create index "subjectdigest_value" to table: "subject_digests"
40 CREATE INDEX "subjectdigest_value" ON "subject_digests" ("value");
41 -- Create "timestamps" table
42 CREATE TABLE "timestamps" ("id" uuid NOT NULL, "type" character varying NOT NULL, "timestamp" timestamptz NOT NULL, "signature_timestamps" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "timestamps_signatures_timestamps" FOREIGN KEY ("signature_timestamps") REFERENCES "signatures" ("id") ON UPDATE NO ACTION ON DELETE SET NULL);