...
1CREATE TABLE "identities" (
2"id" UUID NOT NULL,
3PRIMARY KEY("id"),
4"traits_schema_id" VARCHAR (2048) NOT NULL,
5"traits" jsonb NOT NULL,
6"created_at" timestamp NOT NULL,
7"updated_at" timestamp NOT NULL
8);
9CREATE TABLE "identity_credential_types" (
10"id" UUID NOT NULL,
11PRIMARY KEY("id"),
12"name" VARCHAR (32) NOT NULL
13);
14CREATE UNIQUE INDEX "identity_credential_types_name_idx" ON "identity_credential_types" (name);
15CREATE TABLE "identity_credentials" (
16"id" UUID NOT NULL,
17PRIMARY KEY("id"),
18"config" jsonb NOT NULL,
19"identity_credential_type_id" UUID NOT NULL,
20"identity_id" UUID NOT NULL,
21"created_at" timestamp NOT NULL,
22"updated_at" timestamp NOT NULL,
23FOREIGN KEY ("identity_id") REFERENCES "identities" ("id") ON DELETE cascade,
24FOREIGN KEY ("identity_credential_type_id") REFERENCES "identity_credential_types" ("id") ON DELETE cascade
25);
26CREATE TABLE "identity_credential_identifiers" (
27"id" UUID NOT NULL,
28PRIMARY KEY("id"),
29"identifier" VARCHAR (255) NOT NULL,
30"identity_credential_id" UUID NOT NULL,
31"created_at" timestamp NOT NULL,
32"updated_at" timestamp NOT NULL,
33FOREIGN KEY ("identity_credential_id") REFERENCES "identity_credentials" ("id") ON DELETE cascade
34);
35CREATE UNIQUE INDEX "identity_credential_identifiers_identifier_idx" ON "identity_credential_identifiers" (identifier);
View as plain text